Hello everyone,
I once again have a problem :p I need to write a query to get the total amount of rows in a table. Problem is, the table name is dynamic and part of its value is stored in another table. Here's my query:
What I'm trying to do is to count the total amount of rows in a table named CDT_DEM_DATA_[blank] where [blank] is a name like "test" that is stored in CDT_DEM_Pages as a column (named alphanumericnam e). I'm not exactly sure how to append the alphanumericnam e column's data into the query dynamically to find the total amount of rows in it...
MGM out
I once again have a problem :p I need to write a query to get the total amount of rows in a table. Problem is, the table name is dynamic and part of its value is stored in another table. Here's my query:
Code:
SELECT id, name, (SELECT COUNT(*) AS amtColumns FROM CDT_DEM_Columns WHERE (pageid = a.id)) AS amtColumns, (SELECT COUNT(*) AS amtRows FROM [B]CDT_DEM_DATA_+a.alphanumericname[/B] WHERE (pageid = a.id)) AS amtRows FROM CDT_DEM_Pages AS a ORDER BY name
MGM out
Comment