I am using MySQL. I have a table where I need to be able to manually sort the priority / order of the rows. Initially, I thought about assigning each row to an arbitrary order (1, 2, 3, etc.), and then just βswappingβ the order with the moved row, but I donβt think this is the best way to do this.
After some reading on related issues here ( like this one ), many people said to assign a value to a priority column based on the identifier column (id * 1000). And to change the order of the rows, you split / subtract the difference between the columns. I do not quite understand how this works.
This is the layout of the table to be sorted.
CREATE TABLE liability_detail ( id int NOT NULL AUTO_INCREMENT, analysis_id int NOT NULL, //(many-to-one relationship with analysis table) other_columns various datatypes sequence int DEFAULT 0 )
I would like to set up an easy way to control the priority of strings so that I can easily sort them without creating a lot of code to manage everything.
Jeff
source share