-1

I want to update only the last row from the table logs.. which is arranged in ascending order by ID field.. following query gives the error

update Inventory.logs as a set a.Session=90 where a.ID=(select max(ID) from Inventory.logs)

gives error

you cant specify target table a for update in From Clause
IUN KHAN
  • 30
  • 1
  • 7

1 Answers1

0

Try this code i hope this is hepful

update Inventory.logs set Session=90 order by id desc limit 1
Ariel Pepito
  • 619
  • 4
  • 13