Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JDBC and Relational Databases and the fly likes 'Order by'  vs 'Group by' Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark " Watch " New topic

'Order by' vs 'Group by'

Rao Raghu
Ranch Hand

Joined: Jan 05, 2007
Posts: 100
Whats the difference between 'Order by' and 'Group by'in SQL? Where do we use each?

RAGHU<br /> <br />"When the going gets tough, the tough get going"
Arman Galustyan

Joined: Mar 07, 2007
Posts: 10

Software development is risky.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32481

Order by is for sorting.

Group by is for providing groups/sets of columns that you can provide some function on like count(*)

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: 'Order by' vs 'Group by'
It's not a secret anymore!