SQL Query Current Date Minus 180 days?

user3831078

Query I'm getting a syntax error:

SELECT "LastFilterDate" 
FROM "Filter Cartridge Updates" 
WHERE "Filter Cartridge Updates"."LastFilterDate" < DATE_SUB(CURDATE(),INTERVAL 180 DAY)

I want to select the LastFilterDateS that are older than the current date minus 180 days (6 months).

I'm using LibreOffice base.

error in question:

SQL Status: HY000 Error code: 1000

syntax error, unexpected $end, expecting BETWEEN or IN or SQL_TOKEN_LIKE

Sandesh gave a fantastic link on the subject, but I'm still getting a syntax error. variations I've tried:

SELECT * 
FROM Filter Cartridge Updates 
WHERE LastFilterDate BETWEEN DATE( DATE_SUB( NOW() , INTERVAL 180 DAY ) ) AND DATE ( NOW() )


SELECT * 
FROM "Filter Cartridge Updates" 
WHERE "Filter Cartridge Updates"."LastFilterDate" BETWEEN DATE( DATE_SUB( NOW() , INTERVAL 180 DAY ) ) AND DATE ( NOW() )
veta

The problem is that you're using MYSQL syntax for an SQL that is not MYSQL.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related