I have had problems formulating a query that allows me to consult all the services with a date and time range.
Case: I must show the services from the previous day to the next day, example: 05/01/2019 15:00:00 to 05/02/2019 15:00:00, with a simple BETWEEN it would work for me, but when creating the entity relation model we define two fields "Date" type DATE and "Hour" type TIME.
Here my DB:
With ADDTIME() you can add the time to your date.
This example shows the services and their "datetime" that took place between the current date and two days ago.
You must convert the time field to date when making the query. If you are using sql oracle you have the TO_DATE. Here are some examples of how you can use it:
TO_DATE function oracle
To make it easier for you to make the comparison, you should combine the fields "Date" (DATE) and "Hour" (TIME), and create a field of type DATETIME with format
YYYY-MM-DD hh:mm:ss
Another alternative, if you don't want to change the table, would be to modify the query you make, but it seems more cumbersome to me. In any case, if you want to follow this path, upload the code with which you make the query so that we can help you better.