Since we're on this topic, what do other databases return for these queries?
sqlite> select 1 as a, 2 as b UNION ALL select 3 as b, 4 as a; a|b 1|2 3|4 sqlite> select * from (select 1 as a, 2 as b UNION ALL select 3 as b, 4 as a) where b = 3; b|a 3|4 sqlite> select * from (select 1 as a, 2 as b UNION ALL select 3 as b, 4 as a) where b = 2; sqlite> select * from (select 1 as a, 2 as b UNION ALL select 3 as e, 4 as b) where b = 2; e|b 1|2 sqlite> select * from (select 1 as a, 2 as b UNION ALL select 3 as e, 4 as b) where b > 0; e|b 1|2 3|4 --- Nemanja Corlija <[EMAIL PROTECTED]> wrote: > On 3/25/06, Rob Lohman <[EMAIL PROTECTED]> wrote: > > Microsoft SQL seems to use the column names from the > > first select. So that would be "a, b" in your example. > This seems to be the case for current stable versions of Firebird, > Postgres and MySQL as well. > > -- > Nemanja Corlija <[EMAIL PROTECTED]> > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com