Just a small addition to something that is even missing from the link combo provided.
If - in your Select statement - field [tt]Category[/tt] is a second field, and [tt]Overall[/tt] field is 7th (for example), you may do:[blue]
[tt]ORDER BY 2, 7 DESC[/tt][/blue]
but I would not advise this approach.
---- Andy
"Hmm...they have the internet on computers now"--Homer Simpson
That should be another thread, but...
[tt]
Select Category, MAX(Overall) As MaxOverall
From TableName
Group By Category[/tt]
If you want to add [tt]Company[/tt] field to this query, you will need to provide additional information about your table, like a PK field.
Or you may just try this:
[pre]
Select A.Category, A.Company, A.Overall
From TableName A,
(Select Category, MAX(Overall) As MaxOverall
From TableName
Group By Category) X
Where A.Category = X.Category
And A.Overall = X.MaxOverall
Order by ...
[/pre]
---- Andy
"Hmm...they have the internet on computers now"--Homer Simpson
Yes, apologies, did intend to confess it should have been in a new thread.
Huge thanks for the response. I'd tried a query including Company and it didn't give the right answer, not surprisingly on reflection. I can cop out and get the Company name from another table but your solution looks neat. I'm not that au fait with subqueries so time to learn.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.