GROUP BY Examples
Example 1:
SELECT pop, city FROM table WHERE pop > 50000 GROUP BY city
If the data source provider supports GROUP BY, the entire query is delegated to the data source provider.
Example 2:
If a data source provider does not support GROUP BY but supports ORDER BY, then the delegated query will return an ORDER BY on the column to be grouped. Spectrum Spatial will then handle the GROUP BY using the results of the delegated query.
SELECT hhinc FROM table WHERE pop > 50000 GROUP BY hhinc ORDER BY city
would be delegated to the data source provider as:
SELECT hhinc FROM table WHERE pop > 50000 ORDER BY city
Spectrum Spatial would process the GROUP BY using the results of the delegated query:
SELECT hhinc FROM <results of the delegated query> WHERE pop > 50000 GROUP BY hhinc