mysql - delete where id is the biggest -


i detele row biggest order_id, tried this:

delete orders max(order_id) 

but wrong! other ideas?

thank time.

first idea (among many others had same):

delete orders  order_id =        ( select max(order_id)         orders       ) 

unfortunately mysql complains with:

> error 1093 (hy000): can't specify target table 'orders' update in > clause 

two ways bypass error:

delete orders  order_id =        ( select maxo                       ( select max(order_id) maxo              orders            ) tmp         ) 

or:

delete orders order order_id desc limit 1  

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -