Andy's answer and explanation is consistent with my experience and expectations too.. mostly from MSSQL and Access background.
Sam ------------------------------------------- We're Hiring! Seeking a passionate developer to join our team building products. Position is in the Washington D.C. metro area. If interested contact [EMAIL PROTECTED] -----Original Message----- From: Andrew Finkenstadt [mailto:[EMAIL PROTECTED] Sent: Thursday, April 12, 2007 3:42 PM To: [EMAIL PROTECTED] Subject: Re: [sqlite] Help with SQL syntax. Ticket #2296 My understanding is: select a, b from t1 union select b, a from t1 is equivalent to select a as a, b as b from t1 union select b as a, a as b from t1 And therefore, the first sql statement controls the resulting column names, and the order by applies to the column names (transitively) from the first statement. I'll find a reference in SQL89/SQL92 to support my understanding, but this is how Oracle behaves. :) --andy ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------