JOIN wouldn't be right anyway.
You mean a UNION. And you COULD do that, but you are right, it would probably perform very badly.
I hate to say it, but likely the best way is to simply loop through all the tables, one at a time. Especially if you don't know which field (or fields) to search in each table until you query its schema.
But you *COULD* do a set of unions (e.g., 5 tables per union, so you only make 12 separate queries??), especially if some of the tables have similar structures. I'm not sure that would buy you tons of performance, but surely would get you some.
|