我想计算满足此查询条件的行数:
Select DISTINCT(projects.project_id)
, projects.project_name
, CONVERT(char(11), projects.kickoff_date, 102) AS kickoff_date
, status_phase.status_name
, eal.eal_abbrv
, tech_types.tech_name
from projects
INNER JOIN tech_assigned
ON projects.project_id = tech_assigned.project_id
INNER JOIN tech_types
ON tech_assigned.tech_id = tech_types.tech_id
inner join status_phase
on projects.status_phase_id=status_phase.status_phase_id
inner join eal
on projects.eal_id=eal.eal_id
where status_phase.status_id <= 2
order by eal.eal_abbrv
我想要按 eal.eal_name 列分组的计数,但是当我尝试这样做时,我得到了可怕的“列'projects.project_id'
在选择列表中无效,因为它不包含在聚合函数或 GROUP BY 子句中。” 错误信息。我可以使用Select COUNT(*)
orCOUNT(1)
函数对记录进行计数,但我需要在组内计数。