The MySQL GROUP BYclause is used with SQL SELECT statement to to group selected records into a set of summary records by the one or more column’s value or expression. Now, suppose you want to get groups for each order, you can use the MySQL GROUP BY clause as follows:

SELECT status
FROM orders
GROUP BY status

Display:
It seems that the GROUP BY clause only scans for unique occurrences in the status column and return the result set. However if you look at the data of the orders table you will see that each row in result set above is summary of records that represent a group orders that have the same status on the status column.

0 comments:

Post a Comment

 
Top
Blogger Template