I am trying to delete some rows that are duplicate, or almost duplicates, from a table. I've spent too many hours trying different approaches and researching this and have to ask for help.
From the test "print" statement I put in, it never gets inside the if statement, I never see "I am here" on the screen. Not that it matters but I'm using php.
From the attached picture of my database table, I want to delete the lines, with red arrows, that have duplicate dates/times that have the word 'hide' for the Code. If both similar lines have 'hide' for the code then I only want one, remove the other (thus the Limit 1). Any help is appreciated. Thank you.
$remove = "DELETE FROM teacher_schedule
WHERE (Code='hide')
ORDER BY DateTime
LIMIT 1";
if (@mysqli_query ($connection,$remove)) {
print "I am here";
}