Hello, I have one more question related to SQL query, in which I would like to know how can I get all dates between two dates using SQL Query. For example, I have start date = 10/02/2022 and end date = 14/02/2022, then query must return dates 11/02/2022, 12/02/2022 and 13/02/2022.
I am using SQL Server for this, but I think SQL query will remain the same for oracle or MySQL too.
You can simply use below query to get dates between two dates
select * from TableName where Id = 1
and Date >= '2022/02/10' and Date <= '2022/02/14'
OR
select * from TableName where Id = 1
and Date between '2022/02/10' and '2022/02/14'
In the above queries, we are not considering time-part.
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly