table1(id1)、table2(id2,id1,no)、table3(no,name)
select t3.name from table1 t1(nolock) inner join table2 t2(nolock)
on t1.id1 = t2.id1
inner join table3 t3(nolock)
on t2.no = t3.no
第2張表裡面對應的no字段有可能為空,為空的時候name就為空,這個要怎麼查詢才不會有冗余,請指教
table1(id1)、table2(id2,id1,no)、table3(no,name)
select t3.name from table1 t1(nolock) inner join table2 t2(nolock)
on t1.id1 = t2.id1
inner join table3 t3(nolock)
on t2.no = isnull(t3.no,'')