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 |
|
skillile
Posting Yak Master
208 Posts |
Posted - 2005-09-25 : 16:39:06
|
| data is like thisrowid, datacategory, dataname, datadesc1, 'smile', 'happy face', 'blah'2, 'smile', 'almost happy', 'blah blah'3, 'frown', 'frown face', 'bl'4, 'frown', 'fffff', 'ffff'5, 'frown', 'sdsd', 'sdfsd'How can I get all the rows out + a count of total of datacategory.so:1 smile ....22 smile ....23 frown.....34 frown.....35 frown.....3tnx for the helpslow down to move faster... |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-09-25 : 17:31:22
|
| SELECT A.rowid, A.datacategory, B.totalFROM myTable A INNER JOIN(SELECT datacategory, count(*) as total FROM myTable GROUP BY datacategory) BON A.datacategory=B.datacategory |
 |
|
|
|
|
|
|
|