[thelist] dynamic table sql question

Brian Cummiskey Brian at hondaswap.com
Mon Apr 25 12:40:01 CDT 2005

i'm trying to write a simple query to check each and every table for a 
certain group of phone numbers from another table which lists all the 
jobs and its properties.

this is what i want to do...

select * from (select distinct job_name from jobs)
where phonenumber IN ( <<numbers here>> )

basically, i want to cycle through each job name from the Jobs table, 
and within the same database, there is a table with that Job name.

I.e. Jobs holds: Job1, Job2
and I have the following tables:
in my main listing under the DB.

I know this syntax fails..  but is there a way to do such a thing?

I really don't want to go through and do this manually for 300 different 
job tables to see if those phone numbers are in it.

More information about the thelist mailing list