Join static file xml with ID field with Database table ID field I am using php to display a table with different columns. The table is build from a static xml file with several hundreds of entries. Each entry has also an ID field.
I have to look up that ID field with some other table's ID field inside a Mysql Database..
What would be the most performant way to do this? Because as I see it, I have to iterate through each of the array entries id field and join that with the table id field... which would result in extremely much queries...
Is there another approach how to do it?
Maybe do one query for each of the complete array's entries, and then get back an array from the mysql table query with the corresponding joined id result (with the same matching indexes as the array's entries) in a list?
What would be easiest probably is to build a string list of the IDs that you need to filter on, in PHP first, and pass that in as a parameter to a procedure that uses that parameter with the FIND_IN_SET() function like so:
SELECT *
FROM SomeOtherTable
WHERE FIND_IN_SET(IdField, IdListParameter)