我正在尝试对联盟进行左外连接。查询运行,但不显示联合的列。我错过了什么?这是我的问题:
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'
答案 0 :(得分:2)
您可能应该将它们添加到SELECT
列表中:
SELECT u.*, p.profile_record_id, p.first_name, p.last_name, l.entry_id, l.when_logged, l.amount, l.reason_text
FROM ...