if you want to fetch the records from the below table
Order(varchar) | Order Date(datetime) |
|---|---|
| 150 | 2014-09-26 10:36:18 |
| 1500 | 2014-08-26 09:36:18 |
| 5200 | 2014-06-26 01:36:18 |
| 352 | 2014-09-26 22:36:18 |
| 8654 | 2014-05-26 20:36:18 |
| 2554 | 2014-09-26 14:36:18 |
| 780 | 2014-03-26 18:36:18 |
| 1200 | 2014-09-26 15:36:18 |
Ques: Find out Total amount and month name of order in the Sep 2015
QUERY: SELECT SUM( total ) , month( date_added ) FROM `order` WHERE month( date_added ) =9
OUTPUT:
Order | month |
|---|---|
| 4256 | 9 |
No comments:
Post a Comment