我有两个表:CustomerInformation
CustomerName CustomerAddress CustomerID LocationID BillDate
CITY - 1 500 N ST 47672001 29890 2012-07-20 00:00:00.000 0
CITY - 1 500 N ST 47672001 29890 2012-07-20 00:00:00.000 6890
CITY - 1 500 N ST 47672001 29890 2012-08-17 00:00:00.000 0
CITY - 9 510 N ST 47643241 29890 2012-08-17 00:00:00.000 5460
CITY - 4213 500 S ST 43422001 29890 2012-09-17 00:00:00.000 0
CITY - 5 100 N ST 23272001 29890 2012-09-17 00:00:00.000 4940
CITY - 3 010 N ST 43323001 29890 2012-10-19 00:00:00.000 0
CITY - 78 310 N ST 12222001 29890 2012-10-19 00:00:00.000 5370
CustomerMeters 有三列:ID、Name、Address
这两个表之间的联系是:CustomerAddress,所以我可以根据Address将两者连接起来:
SELECT * FROM CustomerInformation
JOIN CustomerMeters
ON CustomerAddress = Address
现在,问题是我有这么多记录(CustomerInformation 中超过 20000 条),我是否列出了两个表中匹配的记录数,以及仅在 CustomerInformation 表中的记录数?
谢谢你。