I am trying to find all the recorded on a specific date, my date column is of type datetime.
I can’t understand why it’s giving me this error
SELECT *
FROM dbo.Clientes
WHERE registrado = CONVERT(DATE,registrado) = '2022-10-20'
ORDER BY ID DESC
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ‘=’.
>Solution :
Try too much "="
SELECT *
FROM dbo.Clientes
WHERE CONVERT(DATE,registrado) = '2022-10-20'
ORDER BY ID DESC
To be honest I prefer the use of "CAST" instead of "CONVERT"
SELECT *
FROM dbo.Clientes
WHERE CAST(registrado AS DATE) = '2022-10-20'
ORDER BY ID DESC