What do I need to add to my code to change the date format from 'DD-MM-YYYY HH: MM: SS' to 'DD-MM-YYYY'
This is what I get:
rog_date total_grand
2021-09-29 00:00:00 150
code:
SELECT rog_date, SUM(garnitura) AS total_grand FROM G0003 GROUP BY date(rog_date)
CodePudding user response:
Use DATE_FORMAT
SELECT DATE_FORMAT('2021-09-29 00:00:00',('%d.%m.%Y')) as 'date', 150 as 'Granbt total'
date | Granbt total :--------- | -----------: 29.09.2021 | 150
db<>fiddle here
CodePudding user response:
SELECT DATE_FORMAT(rog_date,'%Y-%m-%d') as date , SUM(garnitura) AS total_grand FROM G0003 GROUP BY date