I have a small doubt, how to manage the following situation. In a DB table i save the relevant data in different columns and at the end i save the exact order in a column called position. This table is binded to a grid. Now I'm implementing the functionality that will make change the position to the rows, but I need still to update the DB. I was asking what is the best practice or the most convenient way to achieve this?
And suggestion is welcome.
Example
Name position
abc 1
def 2
ghj 3
Now I click on the button and I get the following
Name position
def 1
abc 2
ghj 3
I hope that I have explained myself!
Based on the comments this is the real example:
TABLE1 with 3 columns ID1, ID2, POSITION
ID1 AND ID2 are FK's and the table has a PK based on ID1 and ID2
When I select the data to display I use the following query SELECT NAME, ETC FROM TABLE2 INNER JOIN TABLE1 ON ID1 = ID1 WHERE ID2 = 511 ORDER BY POSITIONNow I need to change the position on two elements so the row in TABLE1 for example 311,511,5 needs to became 311,511,4 and the row that was 433,511,4 needs to became 433,511,5. The opposite.
I hope that this helped to clear out my question.
Cheers!