Nested subquery in DATE_SUB
Posted on 2006-05-11
Hi you all,
I'm trying to get the last 2 weeks entries in a table.
I was thinking to use a DATE_SUB and a subquery which returns a Date as it's Date argument, in the WHERE clause.
SELECT DATE_SUB((SELECT MAX(orDate) FROM tblOrderReleases), INTERVAL 18 DAYS).
The resulting Date of the DATE_SUB function is used as one of the dates in a BETWEEN statement.
The SubQuery works. That I know.
OK, it's a bit more than 2 weeks, but that is all right as well.
I think I just can't use a SubQuery inside the DATE_SUB function.
Any ideas as to how to get a range of dates between MAX(orDate) and MAX(orDate) - 18 Days?