I wanted to select only data which are present for all date with repeated data count.
Example My table data is :
| user_id | row_created |
|---|---|
| 8SRWS3hMR | 2020-12-14 00:13:31 |
| 8SRWS3hMR | 2020-12-14 00:35:06 |
| 8SRWS3hMR | 2020-12-14 12:11:37 |
| 8SRWS3hMR | 2020-12-14 13:16:27 |
| 8SRWS3hMR | 2020-12-14 16:30:00 |
| 8SRWS3hMR | 2020-12-14 19:25:11 |
| 8SRWS3hMR | 2020-12-14 19:27:07 |
| 8SRWS3hMR | 2020-12-15 17:14:06 |
| 8SRWS3hMR | 2020-12-16 14:53:54 |
And if I select the date range between 2020-12-14 to 2020-12-17 then the output should be null.
And if I select the date range between 2020-12-14 to 2020-12-16 then the output should be below
| user_id | total | row_created |
|---|---|---|
| 8SRWS3hMR | 7 | 2020-12-14 00:13:31 |
| 8SRWS3hMR | 1 | 2020-12-15 17:14:06 |
| 8SRWS3hMR | 1 | 2020-12-16 14:53:54 |
I had tried the below query
select user_id, count(user_id) as total, row_created from reward
where user_id = '8SRWS3hMR' AND DATE(row_created) BETWEEN '2020-12-14' AND '2020-12-17'
group by DATE(row_created);
But as per my requirement, the output should come null because in BETWEEN date range I have pass '2020-12-17'.
Please ignore the grammar mistakes.