MySQL order column
- Started
- Last post
- 3 Responses
- phirschybar
Is there an "order" column type in MySQL that acts like an id or index column where there is auto-increment but when you delete a record, it will shift all of the higher numbered records down a notch to fill in the gap... and where it would also allow you to insert a record in the middle and shift the higher numbered records up.
If not, anyone have a script that automates this? Pref PHP? Peace and thanks!
- chl0
MySQL does not have any such column type, nor does any database that I'm aware of.
- gerhard0
I see no reason for which you would want to use something like that...
However, if you insist, check www.hotscripts.com and www.mysql.com for starters.
- phirschybar0
What I need it for is to be able to allow people to put a set of items into an order where there are say... 20 records and there is a column that has 1-20 for each item (no duplicates, like an index). Then if someone changes number 20 to be number 5, #5 to #19 will all drop down a notch. In other words, this is a unique index field where no gaps are left..