I have a table which counts messages sent to a particular department. the important structure is basically

ID
Department
Message
DateSent

I want to be able to retrieve a resultset where that looks like this:
Department
MessageCount

something like a SELECT COUNT(ID) Where Department=XXX but collect each individual department count result and join it with the department name it belongs.

can such a thing be done? If it helps, I have the full department details in a separate table, but they are not explicitly linked (although the Department column do logically match).

any help would be appreciated!

If Your table is in Excel, Either Filter or Pivot table in Data Menu can get you all you desire.
Try it.

well I'm using sql server, which is why I posted in this subforum. sorry for not making that more clear... right now I think I might just bind the individual counts by calling selects on each binding row in the web page... not idea but there's only about 2 dozen rows, and this page will not be accessed frequently.

if there is a better solution to get it all in one call, please let me know, thank you!

lol okay i is dumb, it's a group by! never was much of an sql guru... thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.