Im having a slight problem deleting/ updating some specific rows out of my table
when i worked out the select statment i got the correct return on data however when i place the same logic into a delete or update it seems to apply the logic to everything any help would be much appreciated
the select query:
select distinct id, max(timeexecuted) from table1 group by id
the delete query:
where exists (select distinct id, max(timeexecuted) from table1 group by id)
You need to corrolate your subquery. At present it deletes all rows from table1 where there is one or more rows in table1. Do you want to delete all rows where ids match and the timeexecuted matches the most recent timeexecuted?