George Pavlov wrote:
>> For larger tables, you may have to resort to a  
>> union:
>>
>>    select * from foo where name != 'Other' order by name
>>    union
>>    select * from foo where name = 'Other'
> 
> Alas, this suggestion is wrong on two counts: (a) UNION expects a single
> ORDER BY that applies to the whole recordset and which has to come at
> the end; (b) UNION re-sorts anyway (it needs to eliminate the dupes) --

You can also add an imaginary key to sort on, like

select 1, * from foo where name != 'Other'
union all
select 9, * from foo where name = 'Other'
order by 1;

Or independent of column order:

select 1 AS sort_key, * from foo where name != 'Other'
union all
select 9 AS sort_key, * from foo where name = 'Other'
order by sort_key;

Regards,
-- 
Alban Hertroys
[EMAIL PROTECTED]

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to