   SQL: i want max of column, but also display other details
  Hi ive got this table 'ticket'And i want to get the max of ticketcount aswell as output the route name.egWatsons Bay/Taronga Zoo and    361but i get errors when i try this:select route ,max(ticketcount) from ticket ;What should i do?heres my table thanks ROUTETICKETCOUNT------------------------------------------------- -----------Circular Quay/Mosmon    84Darling Harbour/Taronga Zoo 115Manly/Circular Quay85Manly/Darling Harbour  124Mosmon/Neutral Bay 72Neutral Bay/Darling Harbour  44Taronga Zoo/Woolwich9Watsons Bay/Neutral Bay 32Watsons Bay/Taronga Zoo361Woolwich/Darling Harbour 3[edited by - johnnyBravo on May 31, 2004 2:59:53 AM][edited by - johnnyBravo on May 31, 2004 3:00:23 AM]
select route, ticketcount from ticket   where ticketcount = (select max(ticketcount) from ticket)  shmoove   [edited by - shmoove on May 31, 2004 3:23:24 AM];  Use "group by".  For example:select route, max(ticketcount)from ticketgroup by routeYou need to use "group by" on non-aggregate columns in your select clause when you want to have specific column values alongside aggregated values.  You can also use a "having" clause if you want to filter on the aggregated value.  For example:select route, max(ticketcount)from ticketgroup by routehaving max(ticketcount) > 50If you''re using SQL Server, check Books Online for more information on "group by" and "having" 