收到以下错误:
Each GROUP BY expression must contain at least one column that is not an outer reference
我想要一个calculatedDrugDistributionHistory
按设施、月份和年份分组的列表。我只想盘点哪些设施已在哪些月份导入到我们的系统中。
我有这个查询:
select
f.name,
MONTH(cddh.dateGiven) as 'date_month',
YEAR(cddh.dateGiven) as 'date_year'
from
calculatedDrugDistributionHistory cddh
inner join facilityIndividuals fi on fi.facilityIndividualId = cddh.facilityIndividualId
inner join facilities f on fi.facilityId = f.facilityId
group by
f.name,
'date_month',
'date_year'
order by
f.name,
'date_month',
'date_year'