1 2 3 4 5 6 7 8 9 10 11
select t1.table_name, t1.table_rows from information_schema.TABLES t1 JOIN information_schema.TABLES t2 on t2.table_name >= t1.table_name and t1.table_schema = t2.table_schema where t1.table_name like '%_History' and t1.table_schema = 'uba_domain_d9' and t2.table_name like '%_History' and t2.table_schema = 'uba_domain_d9' group by t1.table_name having count(1) % @partitionCount = @partitionExecuter and t1.table_rows > 0 limit 1 ;
You can clone a snippet to your computer for local editing. Learn more.