Problem with Dynamic table names.

2009-06-29 Thread Marco Bartz
I am looking for a way to do the following with a single query: SELECT `ID`, `Name`, `Interface`, (select count(*) FROM CONCAT('listings_', `ID`) WHERE `Status`='Active') as `activeListings` FROM `sites`

Re: Problem with Dynamic table names.

2009-06-29 Thread Marco Bartz
I accidentally sent it before finishing... I am looking for a way to do the following with a single query: SELECT `ID`, `Name`, `Interface`, (SELECT count(*) FROM CONCAT('listings_', `ID`) WHERE `Status`='Active') as `activeListings` FROM `sites` I am querying the sites table and I want to