以下 MS Access 2010 查询仅输出 FirstName、HomePhone 和 ClientNumber 的值。它没有为 LastName 输出任何值。
谁能告诉我如何更改它以便它也输出 LastName 的值?
SELECT
ActiveCustomers.FirstName
, ActiveCustomers.LastName
, tblClientAddress.HomePhone
, ActiveCustomers.ClientNumber
FROM (
SELECT
Clients.ClientNumber
, Clients.FirstName
, Clients.LastName (
SELECT COUNT(ReferralDate) FROM IntakeTable
WHERE Clients.ClientNumber = IntakeTable.ClientNumber
AND Len(ReferralDate & '') > 0
) AS IntakeCount
, (
SELECT COUNT(ExitDate)
FROM ExitTable
WHERE Clients.ClientNumber = ExitTable.ClientNumber
AND Len(ExitDate & '') > 0
) AS ExitCount
FROM Clients
) AS ActiveCustomers
INNER JOIN tblClientAddress
ON ActiveCustomers.ClientNumber = tblClientAddress.ClientNumber
WHERE ActiveCustomers.IntakeCount > [ExitCount]
AND tblClientAddress.CurrentResidence = True;