3

can anyone suggest me way to display all records in MySQL table within a specific date range, and if no records available on the date, it will still display as NULL?

1 Answer 1

2
SELECT * FROM table_name WHERE date IS NULL OR date BETWEEN 'date1' AND 'date2';

If you wish to include date2 with the result, use this

SELECT * FROM table_name WHERE date IS NULL OR date BETWEEN 'date1' AND ADDDATE('date2', INTERVAL 1 DAY);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.