I often use this trick:
SELECT * FROM t1 ORDER BY (IF1 IS NOT NULL), if1;
The first order is by a boolean value, and false comes first. Effectively,
it's the same thought as the union. But if you fear boolean expressions, try
this:
SELECT * FROM t1 ORDER BY (CASE WHEN if1 IS NULL THEN 0 ELSE 1 END), if1;
HTH,
G.
--
while (!asleep()) sheep++;
---------------------------- cut here ------------------------------
----- Original Message -----
From: "Harry Yau" <harry.yau@regaltronic.com>
Sent: Tuesday, December 03, 2002 10:54 AM
> I know that it is possible to do this query. Such as
> SELECT *, 0 AS PreOrder FROM T1 WHERE IF1 IS NULL
> UNION ALL
> SELECT *, 1 AS PreOrder FROM T1 WHERE IF1 IS NOT NULL
> ORDER BY PreOrder, IF1