I have a list of items, and a list of places, and a list which links the items to places.

My code takes a search input of the place id, and then looks for all items in the table that just links items and places, then takes the line of info from the table which holds the item info (id, name, cost etc).

But i want to sort the data by cost. How can i do this?

items (id, name, cost, type, sell)
places (id, name)
item_places (item id, shop id)

Some items belong in multiple places, all places have multiple items. So i can not put shop id into item table.