Question

Could anyone give me a simple example of the use of "Group By" WITHOUT any aggregation function?

What does it do? does it sort the results ? I couldn't find any good example without aggregation function..

Was it helpful?

Solution

is the GROUP BY statement in any way useful without an accompanying aggregate function?

You can perform a DISTINCT select by using a GROUP BY without any AGGREGATES.

Using DISTINCT would be a synonym in such a situation, but the reason you'd want/have to define a GROUP BY clause would be in order to be able to define HAVING clause details.

If you need to define a HAVING clause, you have to define a GROUP BY - you can't do it in conjunction with DISTINCT.

OTHER TIPS

Refer this

Below Links will helpful for both (with aggregate function and without agreegate function)

http://www.tutorialspoint.com/sql/sql-group-by.htm

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top