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;
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;