Jump to content
Server Maintenance This Week. ×

Group By - requires all Select fields


This topic is 3205 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I thought I should post this.  It seems GROUP BY  in FMPs ExecuteSQL function requires all the SELECT fields to work properly where that is not the case with mySql. 

 

SELECT
province, city, COUNT(*)
FROM
data
WHERE
province in ( 'ON', 'BC')
GROUP BY
province, city

 

RESULT:

BC, Abbotsford, 3
BC, Burnaby, 2
BC, Castlegar, 1
BC, Chilliwack, 3

 

 

ca-500.zip

Edited by rivet
  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

Yes, this is true. So a SELECT *, COUNT(*) would require you to list ALL fields that might be returned in the GROUP BY (ugh!) And another reason I don't like to use "*" in the aggregates or in the SELECT at all. :)

Link to comment
Share on other sites

This topic is 3205 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.