CREATE TABLE table
(`id` int, `date` date, `time` time);
INSERT INTO table
(`id`, `date`, `time`)
VALUES
(1, '2022-05-22', 14:00:00),
(2, '2022-05-23', 07:35:00),
(4, '2022-05-23', 14:00:00);
Expected Output:
date | time |
---|---|
2022-05-22 | 14:00:00 |
2022-05-22 | NULL |
2022-05-23 | 07:35:00 |
2022-05-23 | 14:00:00 |
As you notice, there's no entry for 07:35 at date 2022-05-22.
I have tried join on single table and CTE also but nothing works.
I'm using PHP with MySQL
Thanks in advance.