I have a staging table where I have the data for every time-stamp. For aggregated tables, I need to ‘group by’ the timestamp in year-month format. For this DATE_FORMAT(sample_date, '%Y-%m') function is used. This will give the output 2016-01.
While grouping the data by year-month format, I should have a sum of the data corrected to two decimal points. Hence
round()
function is used.
round(sum(share_price),2)