Subject union
Author danyschaer
Hi All;

(FB 2.5 beta1, Win32)

If I run this query, works very well:

select first 3 "FECH","HORA" from "MOVI" where "HECH"='P'
union
select first 3 "FECH","HORA" from "MOVI" where "HECH"='E'

But, if I add an "order by" clause for each sub-query, it does not. (I know ways for overcomming this, but I am asking just because it sounds a little "incoherent"):

Preparing query: select first 3 "FECH","HORA" from "MOVI" where "HECH"='P' order by "FECH"
union
select first 3 "FECH","HORA" from "MOVI" where "HECH"='E' order by "FECH"
*** IBPP::SQLException ***
Context: Statement::Prepare( select first 3 "FECH","HORA" from "MOVI" where "HECH"='P' order by "FECH"
union
select first 3 "FECH","HORA" from "MOVI" where "HECH"='E' order by "FECH" )
Message: isc_dsql_prepare failed

SQL Message : -104
Invalid token

Engine Code : 335544569
Engine Message :
Dynamic SQL Error
SQL error code = -104
Token unknown - line 2, column 1
union

Thank you.

Dany