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 |
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2012-02-27 : 21:40:45
|
Hi All,I have following data in the table pls help me to get the result set shown below.enquiry_id userid 123 100457 100100 100102 500107 500Output resultuserid enquiry_count100 3500 2 -Gangadhara |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-27 : 21:51:39
|
its just as simple asSELECT userid,COUNT(enquiry_id) AS enquiry_countFROM tableGROUP BY userid Its a bit surprising that even after reaching 400 + posts you still doesnt seem to know simple GROUPing conceptssuggest you read thishttp://www.w3schools.com/sql/sql_groupby.asp------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|