This is a discussion on SELECT... WHERE id IN list_of_ids , avoiding loop ? within the MySQL Database forums, part of the Database Forums category; I have a set of id's : city_ids = [ id1, id2, ..... idn] to select all proposals where proposals.city_id is in ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have a set of id's : city_ids = [ id1, id2, ..... idn]
to select all proposals where proposals.city_id is in this set, 1- I can loop over the list items 2- I can create a temporary table of selected_id's and match it with the proposals table 3- I can use the where.. in .. clause, select * from proposals WHERE proposals.city_id IN id1, id2, ..... idn, which should be the best option, but if this set is large (10 to 400 items) I can explode the SELECT clause string limit... any suggestion ?... performance is obviously my concern thanks for your lights joss |