我有 2 列:
[tblCustomer]
[tblInquiry]
我想返回所有客户(因此在本例中为 6 条记录)。此外,如果至少有 1 个 Inquiry 没有准备好(完成),则附加一个值为 [False]
[result]的字段,
此 Query 返回 7 条记录:
这可能吗?如果是,我做错了什么?
提前致谢。
ID | DebtNr | CustomerName
1 | 10001 | CustomerNr001
2 | 10002 | CustomerNr002
3 | 10003 | CustomerNr003
4 | 10004 | CustomerNr0ab
5 | 10008 | CustomerNr0yy
6 | 10012 | CustomerSomeName
ID | CustID | IsInquiryReady
1 | 1 | True
2 | 1 | False
3 | 6 | True
4 | 2 | False
ID | DebtNr | CustomerName | IsAtLeastOneNotReady
1 | 10001 | CustomerNr001 | True
2 | 10002 | CustomerNr002 | True
3 | 10003 | CustomerNr003 | False
4 | 10004 | CustomerNr0ab | False
5 | 10008 | CustomerNr0yy | False
6 | 10012 | CustSomeName | False
SELECT [tblCustomer].ID, [tblCustomer].CustomerName, [tblCustomer].DebtNr, [tblInquiry].ID, [tblInquiry].IsInquiryReady
FROM [tblCustomer] LEFT JOIN [tblInquiry] ON [tblInquiry].CustomerID = [tblCustomer].Id;
问问题
46 次