我有 2 张桌子:
发票
CustomerInvoiceID - PK
RecordLocator - Text
createdDate - date
简化发票
CustomerInvoiceID - PK / FK Invoices
CountryCode - text
VatPercentage - number
SubtotalAmount - number
TotalAmount - number
如果我运行以下查询:
select
si.CountryCode,
si.RecordLocator,
si.CustomerInvoiceID,
i.CreatedDate,
i.VatPercentage,
si.SubTotalAmount,
si.TotalAmount
from
SimpliedInvoice si , invoice i
where
si.CustomerInvoiceID = i.CustomerInvoiceID
and si.CountryCode = 'GR'
我的结果是一个空数据集。
但如果我运行这个查询:
select *
from SimpliedInvoice
where CustomerInvoiceID in (select CustomerInvoiceID
from Invoice
where CountryCode = 'GR')
我得到了大量的数据。
我不明白为什么,有什么想法吗?