My current issue is as follows. The below select script works perfectly.
SELECT *
FROM orderheader, orderbody, orderbodylocation
WHERE orderheader.DateCreated > '2011-02-01 00:00:00'
AND orderheader.OrderID = orderbody.OrderID
AND orderbody.OrderBodyID = orderbodylocation.OrderBodyID
AND orderbody.OrderID = orderbodylocation.OrderID
AND orderheader.Status <= 1
but the below delete query which is a duplication of the where clauses fails around the dateCreated clause.
DELETE
FROM orderheader, orderbody, orderbodylocation
WHERE orderheader.DateCreated > '2011-02-01 00:00:00'
AND orderheader.OrderID = orderbody.OrderID
AND orderbody.OrderBodyID = orderbodylocation.OrderBodyID
AND orderbody.OrderID = orderbodylocation.OrderID
AND orderheader.Status <= 1
the DateCreated field within orderheader table is a DATETIME type.
I'm trying to delete every order newer then 1-2-2011 (d-m-y) along with the orderheaders associated table data in orderbody and orderbodylocation tables.
I've run out of ideas and I haven't had much experience with mysql DateTime datatype fields. If anyone can see my error it would be greatly appreciated if you could let me know what I've done wrong.