Question about "BETWEEN"

Suppose that value1 and value2 are dates, and that date is a date field in the database. This query:


SELECT *
FROM table
WHERE date BETWEEN value1 and value2

returns all the rows where the date field is between value1 and value2.

What if I want to return all the rows where the date field goes just from value1 or just to value2? Is this possible using BETWEEN?

Could you give an example of what you mean? The way you’ve described is kinda vague tbh.

Yes, I though so :smiley:

I mean, I want to find all the rows that have a date that goes from “March 13th 2011” on, with no upper limit.

The normal comparison operators work on dates to in MySQL, so you can just use

WHERE date > value

or WHERE date >= value if you want to include value itself :slight_smile:

Awesome, thank you very much! :slight_smile: