Try something like:
SELECT
appt."start_datetime", appt."entered_datetime", appt."long_comment",
patbooking."diagnosis",
probooking."name",
apptack."change_datetime",
res."res_id",
visit."admit_reason",
pat."birthdate", pat."home_phone", pat."name_legal",
res_1ordering."name",
res_2referring."name"
FROM
{ oj ((((((((("prod"."dbo"."appt" appt INNER JOIN "prod"."dbo"."patbooking" patbooking ON
appt."appt_id" = patbooking."appt_id")
INNER JOIN "prod"."dbo"."resbooking" resbooking ON
appt."appt_id" = resbooking."appt_id")
INNER JOIN "prod"."dbo"."probooking" probooking ON
appt."appt_id" = probooking."appt_id")
INNER JOIN "prod"."dbo"."visitapptlist" visitapptlist ON
appt."appt_id" = visitapptlist."appt_id")
LEFT OUTER JOIN "prod"."dbo"."apptack" apptack ON
appt."appt_id" = apptack."appt_id")
INNER JOIN "prod"."dbo"."visit" visit ON
visitapptlist."visit_id" = visit."visit_id")
INNER JOIN "prod"."dbo"."pat" pat ON
patbooking."pat_id" = pat."pat_id")
INNER JOIN "prod"."dbo"."res" res_1ordering ON
patbooking."ordering_phys_id" = res_1ordering."res_id")
INNER JOIN "prod"."dbo"."res" res ON
resbooking."res_id" = res."res_id")
LEFT OUTER JOIN "prod"."dbo"."res" res_2referring ON
patbooking."referring_phys_id" = res_2referring."res_id"}
WHERE
appt."start_datetime" >= {ts '2005-10-11 00:00:00.00'} AND
appt."start_datetime" < {ts '2005-10-12 00:00:59.00'} AND
(res."res_id" = 1282 OR
res."res_id" = 1279 OR
res."res_id" = 1109 OR
res."res_id" = 1107 OR
res."res_id" = 1103 OR
res."res_id" = 1099 OR
res."res_id" = 1094 OR
res."res_id" = 1042 OR
res."res_id" = 1101)
union all
SELECT
table2."start_datetime", table2."entered_datetime", table2."staffmeeting",
patbooking."diagnosis",
probooking."name",
apptack."change_datetime",
res."res_id",
visit."admit_reason",
pat."birthdate", pat."home_phone", pat."name_legal",
res_1ordering."name",
res_2referring."name"
FROM
{ oj ((((((((("prod"."dbo"."table2" table2 INNER JOIN "prod"."dbo"."patbooking" patbooking ON
table2."appt_id" = patbooking."appt_id")
INNER JOIN "prod"."dbo"."resbooking" resbooking ON
table2."appt_id" = resbooking."appt_id")
INNER JOIN "prod"."dbo"."probooking" probooking ON
table2."appt_id" = probooking."appt_id")
INNER JOIN "prod"."dbo"."visitapptlist" visitapptlist ON
table2."appt_id" = visitapptlist."appt_id")
LEFT OUTER JOIN "prod"."dbo"."apptack" apptack ON
table2."appt_id" = apptack."appt_id")
INNER JOIN "prod"."dbo"."visit" visit ON
visitapptlist."visit_id" = visit."visit_id")
INNER JOIN "prod"."dbo"."pat" pat ON
patbooking."pat_id" = pat."pat_id")
INNER JOIN "prod"."dbo"."res" res_1ordering ON
patbooking."ordering_phys_id" = res_1ordering."res_id")
INNER JOIN "prod"."dbo"."res" res ON
resbooking."res_id" = res."res_id")
LEFT OUTER JOIN "prod"."dbo"."res" res_2referring ON
patbooking."referring_phys_id" = res_2referring."res_id"}
WHERE
table2."start_datetime" >= {ts '2005-10-11 00:00:00.00'} AND
table2."start_datetime" < {ts '2005-10-12 00:00:59.00'} AND
(res."res_id" = 1282 OR
res."res_id" = 1279 OR
res."res_id" = 1109 OR
res."res_id" = 1107 OR
res."res_id" = 1103 OR
res."res_id" = 1099 OR
res."res_id" = 1094 OR
res."res_id" = 1042 OR
res."res_id" = 1101)
ORDER BY
1 ASC, 5 ASC
Basically, copy the first part of the query and then change only the Table1 table names to Table2. Also note that the order by should be after the second query, using the sequential order of the fields, rather than the field names. I'm unclear what corresponds to your "Appt" field, but assumed it was the long_comment field, which it might not be.
You should be able to create a parameter in the usual way, but you cannot build it directly into the SQL, but instead would add it to the selection criteria formula area. This will process locally, but at least allows you to use a parameter.
-LB