0
I am trying to delete lines from a table using as a reference the difference between the current date and the date the line was registered. Here is my code:
DELETE FROM lixeira
WHERE diferenca > 60 IN
(
SELECT DATEDIFF('2018-11-20',data_exclusao) AS diferenca
FROM lixeira
)
Since "data_deletion" is the column that stores the registration date of the row data. However, the console is returning me the following error:
Why don’t you call
datediff
right in thewhere
? Something likewhere datediff(...) > 60
– Woss
I tried, but I wasn’t erasing the lines of agreement I wanted, I’ll try again.
– bruno santos
Also confirm the function parameters in the documentation, the type of return and the type of columns involved.
– Woss
It worked, apparently it was because the column "data_exclusion" was DATETIME, I switched to DATE and it worked, thanks for the warning.
– bruno santos