Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Group By
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00733350
Message ID:
00733378
Views:
17
Against SQL databases this would never work. This includes SQL Server and Oracle. The aggregate error means that any column not in the group by cluase has to be an aggregated column. For example SUM(Blah.C), Count(Blah.D), MAX(Big.E), MIN(Big.F). So when you have a group by clause, each column in the SELECT column list must either be in the GROUP BY clause or aggregated.

>Select Dodah.A, Dodah.B, Blah.C, Blah.D, Big.E, Big.F
>FROM Dodah INNER JOIN Blah on Blah.A = Dodah.A INNER JOIN Big ON Big.A = Dodah.A
>GROUP BY Dodah.A, Dodah.B
>
>I'm spoiled by fox! If I issue this command agains a foxpro table, I get one record for each instance of Dodah.A, Dodah.B. If I issue the same command against a SQL Table, I get an error for each of the fields not found in the group by.
>
>Column 'Blah.C' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
>
>This appears to me to essentially make the group by useless in SQL for what I am trying to accomplish is this query. I can see how to do this with two queries, pull the unique Dodah.A, Dodah.B into one table then join back to the original table. But is there another way to make this work against SQL Tables?
>
>Thanks
>Donna
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform