php - Find out which months have data logged in MYSQL database? -
php - Find out which months have data logged in MYSQL database? -
in database have date of each client order stored in format 02 mar 2015
i have info march , apr , want query homecoming 2 months. 1 time have info may homecoming 3 months etc.
the sql syntax trying utilize is:
select distinct month(date_format(date,'%d %b %y')) orders however returns 0 rows. presume issue date format.
edit:
sample info table:
id | date | time | order_id | item | quantity 1 | 02 mar 2015 | 14:22 | 1029 | clasico | 9 1 | 05 apr 2015 | 13:58 | 1029 | hindu | 10
try
select distinct month(`order_date`) `orders` where order_date date field in orders
php mysql
Comments
Post a Comment