Funky GROUP BY

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Oct 11 21:49:50 CDT 2006


On 10/11/06 9:43 PM, "Balestrieri, John" <jbalestrieri at ap.org> wrote:

> OK, thought it was related to the new table... So the only workaround is to
> have the fields in the original tables uniquely named across the whole
> database? And Alias did not work because the alias 'was out of context'
> i.e., it did not carry over to the new table?

This one should work:



SELECT Race.SeatNumber, Race.OfficeID, Candidate.CandidateID AS 'CCID',
Results.CandidateID, Race.RaceCountyID, Results.RaceCountyID,
Race.Meta_State, Sum(Results.VoteCount)

FROM    Results, Candidate, Race

WHERE Results.CandidateID = Candidate.CandidateID AND Race.RaceCountyID =
Results.RaceCountyID AND Race.Meta_State='CA' AND Race.OfficeID = 'H'

GROUP BY Race.SeatNumber, Race.OfficeID, Candidate.CandidateID,
Results.CandidateID,
Race.RaceCountyID, Results.RaceCountyID, Race.Meta_State, Results.VoteCount

ORDER BY Race.Seatnumber, Results.VoteCount DESC

-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list