In Mysql, to generate sql statements for each row of the select statement. we need to use group_concat function. It is easier to generate the sql statements in oracle but it is little different in Mysql.
Below is the statement that we need to use to make it work.
select group_concat(concat('select count(*) from ',table_schema,'.',table_name,';') ) from
information_schema.tables where table_schema='TEST' group by table_name;
information_schema.tables where table_schema='TEST' group by table_name;
output will be :
select count(*) from table_schema.table_name; -- for each row from the above statement.
No comments:
Post a Comment