0

I have DB table and want divide/multiply row record , how it is possible to do it with one SQL Update query, hope your ideas will help to resolve the problem thanks. I have tried the following query but failed

query.exec("UPDATE "+people+ " WHERE id = "+id + " SET ticket_price = ticket_price*2") 

1 Answers1

0

The where clause comes after the set clause, not before it:

UPDATE people
SET    ticket_price = ticket_price * 2
WHERE  id = <some id>
Mureinik
  • 297,002
  • 52
  • 306
  • 350