I'm trying to select rows from yesterday, here is my SQL request :
SELECT
"mytable"."ID",
"mytable"."DISPLAYLABEL" as "Title",
"mytable"."EMSCREATIONTIME" as "Date/Hour of creation"
FROM "view_1"."mytable"
WHERE DATE("mytable"."EMSCREATIONTIME") = DATE_SUB(NOW(), INTERVAL 1 DAY)
I receive syntax error
I also tried :
SELECT
"mytable"."ID",
"mytable"."DISPLAYLABEL" as "Title",
"mytable"."EMSCREATIONTIME" as "Date/Hour of creation"
FROM "view_1"."mytable"
WHERE DATE("mytable"."EMSCREATIONTIME") = DATE( NOW() - INTERVAL 1 DAY )
If I'm selecting rows from today, it's working fine using :
SELECT
"mytable"."ID",
"mytable"."DISPLAYLABEL" as "Title",
"mytable"."EMSCREATIONTIME" as "Date/Hour of creation"
FROM "view_1"."mytable"
WHERE DATE("mytable"."EMSCREATIONTIME") = DATE( NOW() )
Hi @Exe
Without knowing which database type you are querying or the error you are seeing, then it's not possible to help.
Post "Diagnostic Info" from Admin > Troubleshooting.
@Exe You have to use interval '1 day' as noted in the documentation: https://www.postgresql.org/docs/current/functions-datetime.html
Metabase will not make your SQL syntax correct, so if the syntax is wrong, then that is still just send to your database, which spits back an error.