Subject Re: [firebird-support] UNION [ALL] Error Question
Author Milan Babuskov
february1874 wrote:
> Why would this query:
> -----------------------------------------------
> SELECT S.*
> FROM SIMULATOR S
> WHERE S.ClientID=13 AND (S.recordType=0) OR (S.recordType=2) OR
> (S.recordType=100)
>
> UNION ALL
>
> SELECT S.*
> FROM SIMULATOR S
> WHERE S.ClientID=13 AND (S.recordType=0)
> --------------------------------------------
>
> produce the error
> ------------------------
> ISC ERROR MESSAGE:
> Dynamic SQL Error
> SQL error code = -104
> Invalid command
> count of column list and variable list do not match
> ---------------------

Have you tried to name all columns in both queries, like:
SELECT s.ClientID, s.RecordType, ...

My guess is that when you write S.* the column order is not determined,
so you can get unpredictable results (different column order in queries).

--
Milan Babuskov
http://fbexport.sourceforge.net