I’m using LibreOffice Base 7.5.7.1., and I have two queries which I’d like to UNION. Both queries work independently, and to ensure the data types match I’ve used CAST. When I use UNION it doesn’t work, and gives the error response “The given command is not a SELECT statement.
Only queries are allowed.” When I ‘run SQL directly’ I get the error response “The data content could not be loaded.” I get this same response with the queries when I run them separately using ‘run SQL directly’. Both queries have come through a few layers of queries involving calculations, and one involves a DISTINCT, if that makes any difference.
SELECT
CAST(“job_id” AS INTEGER) AS “job_id”,
CAST(“task_id” AS INTEGER) AS “task_id”,
CAST(“estimated_task_remainder_minutes” AS REAL) AS “indicative_remainder_minutes”,
CAST(“estimated_task_installation_minutes” AS REAL) AS “indicative_installation_minutes”
FROM
“query_EstimatedLabourFiguresForIndicativeCost”
UNION ALL
SELECT
CAST(“job_id” AS INTEGER) AS “job_id”,
CAST(“task_id” AS INTEGER) AS “task_id”,
CAST(“indicative_remainder_minutes” AS REAL) AS “indicative_remainder_minutes”,
CAST(“indicative_installation_minutes” AS REAL) AS “indicative_installation_minutes”
FROM
“query_IndicativeCostBasicLabourByTaskSingleInstance”;