0
我有三個查詢下面,我想將它們合併成一個查詢,所以我得到三個縣的結果列。我嘗試了與所有表的內部連接,但是我收到了錯誤的數據。我如何結合這三個查詢和縣組?SQL查詢合併
select co.Description
from Counties as co
group by co.Description
select [Total DLL Children] = SUM(cd.NumberOfLanguageSpeakers)
from ClassroomDLL as cd
inner join Classrooms as c on cd.Classroom_Id = c.Id
inner join Sites as s on c.Site_Id = s.Id
inner join Profiles as p on s.Profile_Id = p.Id
inner join Counties as co on p.County_Id = co.Id
group by co.Description
select
[Total Children] = (SUM(demo.NumberOfPreschoolers)
+ SUM(demo.NumberOfToddlers) + SUM(demo.NumberOfInfants))
from ClassroomDemographics as demo
inner join Classrooms as c on demo.Classroom_Id = c.Id
inner join Sites as s on c.Site_Id = s.Id
inner join Profiles as p on s.Profile_Id = p.Id
inner join Counties as co on p.County_Id = co.Id
group By co.Description
我們在談論什麼口味的SQL辦呢? – 2013-03-27 17:21:49
與以前的問題有什麼不同? http://stackoverflow.com/questions/15663727/how-to-combine-three-sql-selects-into-one-query – Taryn 2013-03-27 17:24:31