Return records Timestamp() field

Asked

Viewed 539 times

0

I have a table called interessados, in it have int_data this field is timestamp(), I have 5 records with the following dates:

2016-09-01 10:15:00
2016-09-01 10:50:00
2016-09-01 18:35:00
2016-09-01 23:15:00
2016-09-15 10:00:00

How do I select only those of the day 01/09/2016? Being that it is timestamp() and I can’t do WHERE int_data?

  • Take the test SELECT to_date('1970-01-01', 'YYYY-MM-DD') + 
 numtodsinterval(1472760605, 'SECOND') as TIMESTAMP
FROM DUAL and comes a result 01/09/2016 20:10:05

2 answers

1

can do it this way

WHERE date(int_data) ='20160901'

or even more "relaxed"

 WHERE int_data like '2016-09-01%'

in the first solution you make mysql process the date and in the second you just filter as c is a String

1


I do it in Firebird:

select * from interessados where cast(int_data as date) = '01/09/2016'

I cast in the field and work as a simple date

Browser other questions tagged

You are not signed in. Login or sign up in order to post.