我有兩個查詢可以工作,但我希望根據第一個查詢的結果完成第二個查詢並將所有結果連接在一起。基於公共數據字段加入兩個查詢的結果
首先查詢是
select c.contribution_amount, c.contribution_dt,
c.contribution_descr,c.report_info_id,
p.name_last,p.name_first,p.name_organization,
p.employer,p.occupation,p.job_title,
a.city, a.state_cd, a.postal_code,
r.report_info_ident, r.filer_info_id
from contribution_info c
inner join contribution_persent cp on c.contribution_info_id=cp.contribution_info_id
inner join persent_info p on cp.persent_info_id=p.persent_info_id
inner join persent_address pa on p.persent_info_id=pa.persent_info_id
inner join address_info a on pa.address_info_id=a.address_info_id
inner join report_info r on c.report_info_id=r.report_info_id
where lower(p.name_last) like '%somebody%' or lower(p.name_organization) like '%somebody%'
和第二查詢是
select f1.filer_ident, fp1.filer_persent_kind_cd,
p1.name_last, p1.name_first,p1.name_organization, p1.persent_type_cd
from filer_info f1
inner join filer_persent fp1 on f1.filer_info_id=fp1.filer_info_id
inner join persent_info p1 on fp1.persent_info_id=p1.persent_info_id
where f1.filer_info_id=000000000
and fp1.filer_persent_kind_cd='FILER'
所述第二查詢的00000000需要爲等於所述第一查詢的c.report_info_id
(也表示爲r.report_info_id)
並且行結果需要是所有r,p,c,a,r1,fp1結果的組合
您是否使用區分大小寫排序規則?無論哪種方式,我都以爲LIKE忽視了案件。 ?!?!什麼是00000000? – Strawberry