Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2003-01-30 : 05:07:27
|
| Just wondering if I can get some help here, I haven't done a query like this before and I'm a little stuck. I have a table with the following columnsModIDuserIDphotoIDapproveddateApprovedThis is a transactional table, each time .What I want to do is return the COUNT of each rows for each ModIDexample returned datamod 1000 = 500 rows countedmod 2000 = 23423 rows countedHow can I go about this? I would actually like to go even more in depth if its not too hard as well. I would like the above data returned, but also broken down by the approved columns possible 2 values of either 0 or 1 . example mod 1000 = 260 rows of approved = 0mod 1000 = 240 rows of approved = 1Thanks alot for any insightMike123 |
|
|
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2003-01-30 : 07:24:14
|
| are u looking for something like this?select count(*) as 'mod 1000' from table where mod=1000select (*)as 'mod 2000' from table where mod=2000I am not sure if i have understood u'r question properly;?Expect the UnExpected |
 |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-01-30 : 07:29:37
|
| How about this:SELECT ModID, Approved, COUNT(*) FROM ModTable GROUP BY ModID, ApprovedOS |
 |
|
|
|
|
|