0

I have a date stored in a table called grids in a field called g_date_created. It's stored as a unix timestamp. I want to select all rows from grids that have a g_date_created plus X numbers of days between a certain time range.

For example:

Select * FROM grids 
WHERE g_date_created + 3 days BETWEEN timestamp_1 AND timestamp_2

1 Answer 1

2
Select * FROM grids 
WHERE g_date_created + interval 3 day BETWEEN timestamp_1 AND timestamp_2
Sign up to request clarification or add additional context in comments.

3 Comments

That did it, thanks. Just had to changed days to "day"
Sorry, does this work if timestap_1 and timestamp_2 are unix timestamps or do i need to use from_unixtime on them also?
I just tried it myself - looks like you don't need the from_timestamp at all: sqlfiddle.com/#!9/15b68/4

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.