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 |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2005-10-29 : 04:54:15
|
Hello,I have a phone book table thus :phoneID intusername varchar(20)phone_number varchar(55) now we have loads of users, with lots of entires in their phone book.How do i write an efficient SQL script to show what each user has in his phone book like thusUsername Number of entriesafrika 523madihivana 3030Spirit1 4302Kristen 5333rockmoose 2284 etcSounds a bit tricky, I am wondering if i let the work be done on my web page with repeated regions or on the sql ?Afrika |
|
|
sachinsamuel
Constraint Violating Yak Guru
383 Posts |
Posted - 2005-10-29 : 08:26:02
|
| You want user name with the number of entries in there phone book?Select Username , Count(Username) as 'Number of entries' from Phone_Book group by UsernameHope the above query helps.RegardsSachin Samuel |
 |
|
|
|
|
|