This was my solution:

`( SELECT "appointment"."date" AS "Date", "appointment"."notes" AS
"Description", "physician"."lastname" AS "Comment",
TO_CHAR("appointment"."time", 'HH24:MI:SS') AS "Notes", 'Appt' AS "Type"
FROM "pat_appt", "appointment", "physician", "patient" WHERE
"pat_appt"."appt_id" = "appointment"."id" AND "patient"."id" =
"pat_appt"."pat_id" ) UNION ( SELECT "prescription"."next_fill_date" AS
"Date", "medicines"."generic" AS "Description", "pharmacy"."name" AS
"Comment", "pharmacy"."phone" AS "Note", 'Med Refill' AS "Type" FROM
"pat_med", "prescription", "pharmacy", "medicines", "patient" WHERE
"pat_med"."presc_id" = "prescription"."id" AND "patient"."id" =
"pat_med"."pat_id" AND "medicines"."id" = "prescription"."medication" AND
"pharmacy"."id" = "prescription"."pharm_id" ) UNION ( SELECT "bill"."due" AS
"Date", "bill"."descrip" AS "Description", "bill"."amount" AS "Comment",
"bill"."date_recd" AS "Notes", 'Bill' AS "Type" FROM "pat_bill", "bill",
"patient" WHERE "pat_bill"."bill_id" = "bill"."id" AND "patient"."id" =
"pat_bill"."pat_id" ) UNION ( SELECT "immunizations"."due" AS "Date",
"immunizations"."description" AS "Description", "immunizations"."date" AS
"Comment", "immunizations"."date" AS "Notes", 'Immun Due' AS "Type" FROM
"pat_immun", "immunizations", "patient" WHERE "pat_immun"."imun_id" =
"immunizations"."id" AND "patient"."id" = "pat_immun"."pat_id" )`

The trick was going to Edit->>Run SQL Directly.

Hope someone can benefit from this,

Beth

--
View this message in context: 
http://nabble.documentfoundation.org/UNION-Query-throwing-error-tp3695780p3696185.html
Sent from the Users mailing list archive at Nabble.com.

-- 
For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to