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 923 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 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
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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
      2
      • SGaistS SGaist

        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 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>

        JonBJ 1 Reply Last reply
        0
        • M mark_ua_1999

          @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>

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #4

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

          1 Reply Last reply
          1

          • Login

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