0
此查詢僅返回填寫問題11042並回答「是」的主要記錄。很好,沒有問題。但是,這個主要人員可能會根據他們分配的組成員也可能需要拉入此搜索查詢。但是他們不回答問題11042因此不在字段t2表中。然而,他們在另一個桌子grpMems t3,可以說,這也加入了ID。所以我的問題是我如何顯示這兩個,首要人誰回答問題是,因此在t2表中,以及在另一個t3表中的組成員爲搜索結果?SQL加入幫助將成員從另一個表中包括到搜索結果中
select t1.id,t1.firstname,t1.lastname,t2.field1,t2.field2
from names t1
inner join fields t2 on t1.id=t2.id and t2.field1=2388 and t2.field2=11042 and t2.field3='Yes'
where 1=1
<cfif searchby>
and t1.firstname like '%#searchFIRST#%'
</cfif>
order by t1.lastname,t1.firstname
lc。萬分感謝!非常感激 – user1094441 2013-02-21 06:22:51