1

我正在尝试对工会进行左外部联接。查询运行,但不显示联合中的列。我错过了什么?这是我的查询:

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' 
4

1 回答 1

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    ...
于 2013-01-15T20:28:42.220 回答