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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 SQL Query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-11 : 08:03:21
Jayaprakash writes "I have a table AUTHOR which contains AuthorId, TitleId fields. I would like to retreive which author wrote more titles? Can you send me the simple query for this scnerio?"

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2005-08-11 : 08:07:19
Select AuthorID,Count(1) From Author Group by AuthorID
order by Count(1) Desc

Complicated things can be done by simple thinking
Go to Top of Page

kapilarya
Yak Posting Veteran

86 Posts

Posted - 2005-08-11 : 08:12:22
Select top 1 AuthorID,Count(AuthorID) as [Count] From Author Group by AuthorID
order by 2 Desc

Kapil Arya
Go to Top of Page
   

- Advertisement -