>> Hi, Shane,

>> What I don't understand is why do you need to do that?

>Imagine I have a GUI element with a drop down list of fruit. The
>source of
>the list is my fruit table and it may have many entries. It might
>more
>convenient to list the popular fruit near the top. In that case the
>fruit.sort_order could represent relative popularity of the fruit
>entries.

Would not it simply make more sense then to have the table defined thusly:

create table popularities
(
  id         integer primary key,
  description text collate nocase unique
);
insert into popularities(0, 'Uncommon Fruits');

create table fruits
(
  id         integer primary key,
  popularity integer not null default (0) references popularities,
  fruit      text not null collate nocase unique
);
create unique index fruitorder on fruits (popularity desc, fruit);

Then merely set the "popularity" to the "zone" in which you want the fruit to 
appear (the higher the number the higher group up the list, and still in 
life-form recognizable scanning order within each zone) -- after creating the 
popularities zone of course so that you can label those groupings.

It would cause me to delete your application immediately if it did not sort 
entries into alphabetical order for quick location but instead used some 
addle-minded method of ordering that was illogical and not conducive to 
immediate recognition.  Trust me -- most life forms in the multiverse will see 
this exactly the same way.

select popularity, fruit from fruits order by popularity desc, fruit;




_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to