resetting one particular field in all rows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    resetting one particular field in all rows

    I have a grid table in the front end (PHP on server side), and the master admin can sort data in that grid according to his own wish and save that new sorted order. Once the master admin sorts the data, all the users view data in that order only. And only the master admin has the right to sort and change order.

    What I'm doing is, I have an index field (not primary), according to which the data is displayed in ascending order. When the master admin sorts the data and saves that new order, the index field of all the rows in db are reset according to the new order. And for this resetting, I'm running UPDATE queries equal to the number of rows.

    Now since there can be lot more then 100 rows, and moreover I don't know much about SQL except SELECT, INSERT and UPDATE queries.

    So I was just if there is any other way to do this, so that I need not to run so much queries?

    PS: Is it recommended to run around 200 UPDATE queries at a time?
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    Originally posted by hsriat
    So I was just if there is any other way to do this, so that I need not to run so much queries?
    As far as I know, there is no other way.

    Originally posted by hsriat
    Is it recommended to run around 200 UPDATE queries at a time?
    It will not be a problem if the update statement is being executed on a small table. A table with 200 rows is a small table.

    Comment

    • hsriat
      Recognized Expert Top Contributor
      • Jan 2008
      • 1653

      #3
      Originally posted by mwasif
      As far as I know, there is no other way.


      It will not be a problem if the update statement is being executed on a small table. A table with 200 rows is a small table.

      Thanks for the response! :)

      But If a table has 10000 rows, and then I have to update 200 rows.. any issue?

      Comment

      • mwasif
        Recognized Expert Contributor
        • Jul 2006
        • 802

        #4
        There should not be problem if you have properly indexed your data.

        Comment

        Working...