Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to divide int value of Sqlite db table by 2
Forum Updated to NodeBB v4.3 + New Features

How to divide int value of Sqlite db table by 2

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 917 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mark_ua_1999
    wrote on 21 Nov 2017, 20:24 last edited by mark_ua_1999
    #1

    Hi, I have DB table and want divide row record that is integer by 2 what SQL query could help to do it
    thanks for your help. I have tried the following query
    query.exec("UPDATE "+people+ " WHERE id = "+id + " SET ticket_price = ticket_price*2") but failed
    0_1511295818859_Capture.PNG

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 21 Nov 2017, 21:06 last edited by
      #2

      Hi,

      Do you want to modify the value in the database or only show the value multiplied by two ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply 22 Nov 2017, 08:30
      2
      • S SGaist
        21 Nov 2017, 21:06

        Hi,

        Do you want to modify the value in the database or only show the value multiplied by two ?

        M Offline
        M Offline
        mark_ua_1999
        wrote on 22 Nov 2017, 08:30 last edited by
        #3

        @SGaist Hi the problem is resolved want(modify the value in the database )
        UPDATE people
        SET ticket_price = ticket_price * 2
        WHERE id = <some id>

        J 1 Reply Last reply 22 Nov 2017, 08:36
        0
        • M mark_ua_1999
          22 Nov 2017, 08:30

          @SGaist Hi the problem is resolved want(modify the value in the database )
          UPDATE people
          SET ticket_price = ticket_price * 2
          WHERE id = <some id>

          J Offline
          J Offline
          JonB
          wrote on 22 Nov 2017, 08:36 last edited by
          #4

          @mark_ua_1999
          That looks suspiciously like "multiply" rather than "divide" to me....

          1 Reply Last reply
          1

          1/4

          21 Nov 2017, 20:24

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved