You have a structural problem with your data. Serialized data in the database is terrible if you need to search over pieces of that serialized data.
- There is no reliable, efficient, and certainly no easy, SQL query to
search over serialized data. “serialization” is a PHP mechanism. It
isn’t SQL. To the database that is just a string. Your only SQL choice is a regex on the string. WP_Query
certainly won’t do it. That functionality is not built in, probably for the reason listed above.
Iterating over the data is about the only solution you have given the data structure you are dealing with.
However, the correct solution in my opinion is to alter your data structure so that you are saving granular pieces of data in the database. In other words, use a lot of different keys for the values that you need to search over.