也許我一直在尋找這個太長時間 - 但有人可以幫我看看爲什麼這兩個查詢,這應該返回相同的東西,返回不同數量的行?爲什麼這兩個「等價」查詢返回不同數量的行?
select ip.*
from invoice_payment ip
inner join invoice_item II on ii.invoice_item_uuid = ip.invoice_item_uuid
inner join service_delivery sd on sd.service_delivery_uuid = ii.service_delivery_uuid
inner join #Affected on #Affected.service_delivery_uuid = sd.service_delivery_uuid
select *
from invoice_payment ip
where ip.invoice_item_uuid in (
select ii.invoice_item_uuid from invoice_item ii
where ii.service_delivery_uuid in (
select service_delivery_uuid from #Affected)
)
謝謝!
他們不是等效查詢 – sll