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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Union Query using NotesSQL

Status
Not open for further replies.

simon1974

Technical User
Apr 2, 2002
43
0
0
US
I am trying to reformat the data in a notes table by using a union SQL statement. I am getting an error anytime I try to union more than once (see below)

SELECT CATEGORIES AS AUDIT, HOURS_1 AS HOURS, NAME, Period_1 as PD
FROM Admin_Time_Reporting_Table
WHERE HOURS_1 IS NOT NULL

UNION SELECT CATEGORIES_1 AS AUDIT, HOURS_2 AS HOURS, NAME, Period_1 as PD
FROM Admin_Time_Reporting_Table
WHERE HOURS_2 IS NOT NULL;

The above SQL works just fine, but the below code gives me an invalid SQL syntax error. The below syntax works just fine if I am pointing it at a standard access or SQL Server table, but dies through the NotesSQL driver. Any help would be much appreciated, including alternative approaches to stacking data stored in landscaped fields in a notes table. Thanks!

Erroring Out:

SELECT CATEGORIES AS AUDIT, HOURS_1 AS HOURS, NAME, Period_1 as PD
FROM Admin_Time_Reporting_Table
WHERE HOURS_1 IS NOT NULL

UNION SELECT CATEGORIES_1 AS AUDIT, HOURS_2 AS HOURS, NAME, Period_1 as PD
FROM Admin_Time_Reporting_Table
WHERE HOURS_2 IS NOT NULL

UNION SELECT CATEGORIES_2 AS AUDIT, HOURS_3 AS HOURS, NAME, Period_1 as PD
FROM Admin_Time_Reporting_Table
WHERE HOURS_3 IS NOT NULL;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top