Subject | Union and order by |
---|---|
Author | Lourenço de Paula |
Post date | 2003-03-14T14:02:36Z |
Hello
I'm trying to execute the follow statement:
SELECT FIELD_A X FROM TALBLE_A
WHERE FIELD_A > 100
UNION
SELECT FIELD_B X FROM TALBLE_B
WHERE FIELD_B > 100
ORDER BY X
It�s a exemple, but when I execute the SQL statement the Firebird returns:
"Invalid token. Dynamic SQL Error. SQL error code = -104. Invalid command. invalid ORDER BY clause. "
If I remove the ORDER BY clause it executes sucessfully.
Can I use order by clause with UNION or it is not supported?
Thanks.
Louren�o de Paula
lourenco.d@...
Desenvolvimento Revenda
CNP Engenharia de Sistemas S.A. - Brazil
[Non-text portions of this message have been removed]
I'm trying to execute the follow statement:
SELECT FIELD_A X FROM TALBLE_A
WHERE FIELD_A > 100
UNION
SELECT FIELD_B X FROM TALBLE_B
WHERE FIELD_B > 100
ORDER BY X
It�s a exemple, but when I execute the SQL statement the Firebird returns:
"Invalid token. Dynamic SQL Error. SQL error code = -104. Invalid command. invalid ORDER BY clause. "
If I remove the ORDER BY clause it executes sucessfully.
Can I use order by clause with UNION or it is not supported?
Thanks.
Louren�o de Paula
lourenco.d@...
Desenvolvimento Revenda
CNP Engenharia de Sistemas S.A. - Brazil
[Non-text portions of this message have been removed]