By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,640 Members | 2,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,640 IT Pros & Developers. It's quick & easy.

delete query format

P: 638
hi ,
i have a situation where i need to delete the records from a table where the records status = 'Pending' for more than 10 mins by comparing it with the current time , i wanted to use sql for this purpose but i am receiving this error.
#1093 - You can't specify target table 'jos_reservations' for update in FROM clause
i havent used this method ever so facing problems here is my query that i am using
Expand|Select|Wrap|Line Numbers
  1. DELETE FROM jos_reservations where ((SELECT TIME_TO_SEC(TIMEDIFF('2011-12-15 19:21:22',`added_on`) ) from jos_reservations) >600)
Omer Aslam
Dec 15 '11 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 8,639
why are you specifying a select on the same table in the where clause? just put that as condition in the delete statement.

and I think the second from jos_reservations would be illegal, too
Dec 15 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.