Re: Ordering cars

2009-04-27 Thread Olav Mørkrid
thanks zhu. i found a solution using your suggestion and the manual: http://dev.mysql.com/doc/refman/5.0/en/union.html (select 1 as one, brand, max(year) two from cars group by brand) union (select 2 as one, brand, year two from cars) order by one, two desc; the important question now is perform

Re: Ordering cars

2009-04-26 Thread zhu dingze
select brand, max(year) from cars group by year order by yearunion select brand, year from cars order by year 2009/4/25 Olav Mørkrid > Say I have a table with any number of car brands, with belonging street > dates. > > Is it possible to do the following type of sort in a single query? > > 1. F

Ordering cars

2009-04-25 Thread Olav Mørkrid
Say I have a table with any number of car brands, with belonging street dates. Is it possible to do the following type of sort in a single query? 1. First I want the newest model of all car brands, but only one of each brand! And they should be ordered by year 2. Then I want the cars that weren'