SELECT
B.tblBooking_id,
F.M_Merged_CustomerId,
B.depart_date,
B.cancellation,
B.booking_num,
B.end_date,
B.date_booked,
B.booking_price,
B.tblBooking_Id as SOURCE_RES_ID ,
B.agentid,
B.is_insert_date,
B.is_update_date is_update_date,
A.Agent_Email_Address as agent_email,
A.Agent_Email_Address as agent_email_system
FROM tblBooking B
JOIN tblAgent A
ON B.agentid=A.agentid
LEFT JOIN tblFactCustomers F
ON B.booking_num = F.raw_booking_num
WHERE B.agentid !=0 or B.agentid IS NOT NULL
GROUP BY B.tblBooking_id;
使用されるテーブル: tblBooking、tblAgent、tblFactCustomers インデックスは、予約番号と生の予約番号に存在します。