In the last episode (Dec 16), Mark Leith said:
> Pintér Tibor wrote:
> >Keith Spiller írta:
> >>I'm wondering how I would turn three different queries:
> >>
> >> SELECT * FROM team WHERE office = 'Exec'
> >> SELECT * FROM team WHERE office = 'VP'
> >> SELECT * FROM team WHERE office = 'Dir'
> >>
> >>Into one query with the sort order of office = 'Exec', 'VP', 'Dir'...
> >>Thanks,
> >>
> >order by right(office,1)
> >
> >or make an extra column for ordering
>
> Or be really smart :)
>
> SELECT * FROM team ORDER BY office='Exec' DESC,office='VP' DESC,
> office='Dir' DESC;
More efficient would be to use the FIELD function:
SELECT * FROM team ORDER BY FIELD(office,"Exec","VP","Dir");
--
Dan Nelson
dnelson@stripped