Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query for most popular result of query 1

Status
Not open for further replies.

xhonzi

Programmer
Joined
Jul 29, 2003
Messages
196
Location
US
Code:
SELECT Artists_Cross.Artist, Artists_Cross.Role, Count(Artists_Cross.Role) AS CountOfRole
FROM Artists_Cross
GROUP BY Artists_Cross.Artist, Artists_Cross.Role
HAVING (((Artists_Cross.Artist)="xhonzi"))
ORDER BY Artists_Cross.Artist, Count(Artists_Cross.Role) DESC;

What I'm trying to do here is retrieve the most popular role for a particular artist. The output of this returns:

xhonzi Director 10
xhonzi Coffee Boy 9
xhonzi Writer 5

What I want it to return is the Director line and nothing more. What else do I need to do to my query?

Thanks,
xhonzi
 
How are ya xhonzi . . .

Try [blue]SELECT TOP 1 Artists_Cross.Artist,[/blue] . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Accurate and punctual as always, AceMan. Are you everyone's guardian angel or just mine?

xhonzi
 
xhonzi . . .

Lucky You! . . . I'm one of many! [thumbsup2]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top