SELECT a.* FROM table1 a
LEFT OUTER JOIN table1 b ON a.propertyID = b.propertyID
AND a.userID = b.userID AND b.roleID IS NOT NULL
WHERE b.propertyID IS NULL AND a.roleID IS NULL
This is my query which returns me some records and I want to delete only these records from the same table(table1)
How should I write my delete query