表名:EntryTableSQL GROUPBY多列
ID CharityName Title VoteCount
1 save the childrens save them 1
2 save the childrens saving childrens 3
3 cancer research support them 10
表名:ContestantTable
ID FirstName LastName EntryId
1 Neville Vyland 1
2 Abhishek Shukla 1
3 Raghu Nandan 2
所需的输出
CharityName FullName
save the childrens Neville Vyland
Abhishek Shukla
cancer research Raghu Nandan
我试图
select LOWER(ET.CharityName) AS CharityName,COUNT(CT.FirstName) AS Total_No_Of_Contestant
from EntryTable ET
join ContestantTable CT
on ET.ID = CT.ID
group by LOWER(ET.CharityName)
请指教。
可以在安装了一个[SQL小提琴](http://sqlfiddle.com/)这一点。 –
您不应该按ET.CharityName进行分组,因为这样您将无法获取与其关联的人员的姓名。 –
据我所知,你所需的输出不能用SQL来实现。这就是报告生效的原因。 –