Re: [GENERAL] ORDER BY with exception

2007-06-22 Thread Erik Jones
On Jun 21, 2007, at 8:08 PM, brian wrote: Michael Glaesemann wrote: On Jun 21, 2007, at 17:35 , brian wrote: I have a lookup table with a bunch of disciplines: To answer your ordering question first: SELECT id, name FROM discipline ORDER BY name = 'other' , name; id |name +--

Re: [GENERAL] ORDER BY with exception

2007-06-21 Thread brian
Michael Glaesemann wrote: On Jun 21, 2007, at 17:35 , brian wrote: I have a lookup table with a bunch of disciplines: To answer your ordering question first: SELECT id, name FROM discipline ORDER BY name = 'other' , name; id |name +- 8 | community 4 |

Re: [GENERAL] ORDER BY with exception

2007-06-21 Thread brian
Josh Tolley wrote: It seems to me you could replace it all with one query, something like this: SELECT discipline, COUNT(1) FROM showcase WHERE EXISTS (SELECT * FROM showcase_item WHERE showcase_id = showcase.id LIMIT 1) GROUP BY discipline ORDER BY (discipline != 'other'), discipline; disci

Re: [GENERAL] ORDER BY with exception

2007-06-21 Thread Michael Glaesemann
On Jun 21, 2007, at 17:35 , brian wrote: I have a lookup table with a bunch of disciplines: To answer your ordering question first: SELECT id, name FROM discipline ORDER BY name = 'other' , name; id |name +- 8 | community 4 | dance 5 | film and telev

Re: [GENERAL] ORDER BY with exception

2007-06-21 Thread Josh Tolley
On 6/21/07, brian <[EMAIL PROTECTED]> wrote: I have a lookup table with a bunch of disciplines: # SELECT id, name FROM discipline; id |name +- 1 | writing 2 | visual arts 3 | music 4 | dance 5 | film and television 6 | theatre 7 | media arts

[GENERAL] ORDER BY with exception

2007-06-21 Thread brian
I have a lookup table with a bunch of disciplines: # SELECT id, name FROM discipline; id |name +- 1 | writing 2 | visual arts 3 | music 4 | dance 5 | film and television 6 | theatre 7 | media arts 8 | community 9 | fine craft 10 | other (10 rows