表名: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來實現。這就是報告生效的原因。 –