Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max from union

Status
Not open for further replies.

Elroacho

Programmer
Apr 19, 2004
59
NZ
Hi,

I have the following query which works on SQL Server

SELECT MAX(MaxValue) MaxOverAll
FROM(SELECT MAX(HISTORY.WHENHISTORY) MaxValue
FROM HISTORY
WHERE (HISTORY.READCODE = 'ZPSA10'
OR HISTORY.READCODE = '137S.00')
UNION ALL
SELECT MAX(CLASSIFICATION.WHENCLASS) MaxValue
FROM CLASSIFICATION
WHERE (CLASSIFICATION.READCODE = 'ZPSA10'
OR CLASSIFICATION.READCODE = '137S.00')
) SubQuery

I need to make this run on an interbase database but I get the following error:

Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 2, char 4.
SELECT.

what am i doing wrong?

Cheers,
Kevin,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top