I have a table with the date and time fields separated
Table1
data hora id
2015-01-01 11:40:06 1
2015-01-01 15:40:06 2
2015-01-02 15:40:06 3
2015-01-05 10:40:06 4
2015-01-05 15:40:06 5
2015-01-06 08:23:00 6
Now I need to consult the id between 2015-01-01 12:00:00 12:00:00 and 2015-01-05 12:00:00, , should return the ids 2,3,4. I'm trying to convert and concatenate the date and time fields that are separated in a single datetime field in order to use the 'between' but I can not hit the syntax can someone give an example?
It works!
SELECT
*
FROM
tableA
WHERE
(dataemissao + hora) BETWEEN (date '2015-01-21' + time '14:00')
AND (date '2015-01-21' + time '18:00')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With