Or I guess you'd update the records first where sort = 5 and then insert the new 5, but you get my drift. --Ferg
Ken Ferguson wrote: > On another note, it's not really necessary to get all decimal crazy on > that sort order. If you've got 500 records and you want to insert a new > one and set the sort to 5 then you just do that and then update the sort > field setting sort = sort+1 where sort > 5. It's not terribly complicated. > > --Ferg > > Andy Matthews wrote: > >> Asking this question for a friend... >> ----------------------------------- >> I'm looking for a good way to pull entries from a database based on "rank" >> (an arbitrary sort order). >> >> For example: A business' staff directory listed by seniority or position >> (CEO at top) rather than default or alphabetical sort >> OR: rearranging the display order of photos in a gallery >> etc. >> >> I know I could add a field called 'sort' and assign a numerical value to >> that field. But redefining the order could require modifying that field on >> many records (especially in a photo gallery, where photos are being added >> and removed). And if you wanted to add one between '5' and '6' you would >> have to use something like '5.5' (then '5.7' to insert one between '5.5' and >> '6') which could also get ugly. >> >> There has to be a 'professional' simple solution to this, since it seems >> like a very commonplace requirement. >> ------------------------------- >> >> <!----------------//------ >> andy matthews >> web developer >> ICGLink, Inc. >> [EMAIL PROTECTED] >> 615.370.1530 x737 >> --------------//---------> >> >> >> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:233778 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

