1
我正在嘗試執行聯盟的左外聯接。查詢運行,但不顯示聯合的列。我錯過了什麼?這是我的查詢:MySQL左加入到聯盟
SELECT p.profile_record_id,
p.first_name,
p.last_name,
l.entry_id,
l.when_logged,
l.amount,
l.reason_text
FROM member_profile p
LEFT OUTER JOIN authorize_net_log l
ON (p.profile_record_id = l.profile_record_id)
LEFT OUTER JOIN (SELECT assigned_entry_number,
payment_status AS e_status,
'vehicle' AS type,
profile_record_id
FROM event_entry
UNION
SELECT '',
co_payment_status,
'driver',
profile_record_id
FROM event_co_driver) u
ON (p.profile_record_id = u.profile_record_id)
WHERE l.response_code = '1'
AND l.reason_code = '1'
您確定要使用'UNION'而不是'UNION ALL'? – Kermit
它不應該有任何區別,因爲在這種情況下不會有重複,但UNION ALL可能會更有效。 – George