Reported By: Thad Smith Reported On: 2/18/2002 For: Version 3.05 Build 1
# 1030Using a UNION Clause Where the First SQL SELECT Query Produces an Empty Result Set Does Not Work The following sql statement is returning the year for each row in the second table when the first table is empty. If the first table has data and the second is empty the sql works fine. Each statement works properly when separated.
SELECT DISTINCT EXTRACT(YEAR FROM Post_Date) AS Inq_Year FROM Post
UNION
SELECT DISTINCT EXTRACT(YEAR FROM Tran_Date) AS Inq_Year FROM Tran
Comments and WorkaroundsThe workaround is to switch around the order of the SQL queries so that the SQL query producing the empty result set is after the UNION and not before.
ResolutionFixed Problem on 2/19/2002 in version 3.06 build 1