我的查询工作正常;但是,我需要将另一个数据集加入到我的查询中,并且我希望它count(f.*)
会中断。
这是我开始的查询:
SELECT
MIN(received_date) AS FirstVisit
, patient_id AS PatientID
INTO #LookupTable
FROM F_ACCESSION_DAILY
SELECT
f.doctor AS Doctor
, COUNT(f.*) AS CountNewPatients
, MONTH(firstvisit) AS Month
, YEAR(firstvisit) AS Year
FROM F_ACCESSION_DAILY f
INNER JOIN #LookupTable l ON f.received_date = l.FirstVisit
AND f.patient_id = l.PatientID
GROUP BY f.doctor
, MONTH(firstvisit)
, YEAR(firstvisit)
DROP TABLE #LookupTable
我想在另一个表上加入上述查询。
问题是*我会count(f.*)
保持不变还是会因为我添加了新数据集而改变?*
* *如何确保count(f.*)
遗嘱保持不变?
非常感谢您的指导。