Skip to content

Tag: delete-row

DELETE entry that is older than current datetime in MySQL

I have tried the following among various other statements but thought one of these should obviously work but no luck so far. Please tell me what I’m doing wrong. Not getting an error, it’s just not working. DELETE FROM table_name WHERE from < NOW() DELETE FROM table_name WHERE from < ‘2022-04-16 08:00:00’ Example Answer You shouldn’t name your columns (or

Delete duplicate records in SQL Server?

Consider a column named EmployeeName table Employee. The goal is to delete repeated records, based on the EmployeeName field. Using one query, I want to delete the records which are repeated. How can this be done with TSQL in SQL Server? Answer You can do this with window functions. It will order the dupes by empId, and delete all but