I want to select value from given date and same time if no row in that date then it should return 0 in that specific date. here is my query
SELECT
sum(`value`) AS `VALUE`,
serverTimeStamp AS date
FROM
table1 t1
WHERE
serverTimeStamp BETWEEN CONVERT_TZ(
'2016-03-21 00:00:01',
'+00:00',
'-05:30'
)
AND CONVERT_TZ(
'2016-03-25 23:30:36',
'+00:00',
'-05:30'
)
GROUP BY
YEAR (date),
MONTH (date),
WEEK (date),
DAY (date)
ORDER BY
date ASC;
Output :
value date
96 2016-03-21 00:00:01
76 2016-03-23 00:00:01
56 2016-03-25 00:00:01
Expected Output :
value date
96 2016-03-21 00:00:01
0 2016-03-22 00:00:01
76 2016-03-23 00:00:01
0 2016-03-24 00:00:01
56 2016-03-25 00:00:01
Any idea to achieve this?
table1 :
**id value serverTimeStamp**
1 96 2016-03-21 00:00:01
2 76 2016-03-23 00:00:01
3 56 2016-03-25 00:00:01
but what i am expecting in query if there is no row in given date then it should be 0 and specific date like below
value date
96 2016-03-21 00:00:01
0 2016-03-22 00:00:01
76 2016-03-23 00:00:01
0 2016-03-24 00:00:01
56 2016-03-25 00:00:01