hi,
i have 2 tables: one for a package, and other for the items in that package.
item table has item_id as primary key (set on auto_increment), and a foriegn key package_id that links to the related package.
if the order of items in a package is important, how do I find out the position of each item in a package? The position is gathered simply from the order in which items were entered, so item entered last would have the last position.
say, if I wanted to find out the 10th element in 3rd package, I can query as
select * from items where package_id=3 limit 10,1;
(returns image_id: 37, package_id: 3, etc etc)
but how do I do the reverse? that is, find out the position of an item in a package. so if I put in image_id as 37 (as in above eg), I can get its position in the package.