MYSQL - select difference of rows counts in two tables -
i trying compare number of rows of 2 tables in 2 databases. number of rows should same :
select
(select count(*) db1.table1)-
(select count(*) db2.table1) difference
how select if difference<>0? need run multiple tables , don't need 0 values. load results in c# list , sort out i'd finish in query.
i've tried using information_schema.tables it's not suitable because returns approximate results. i'm using mysql 5.5
select * (select (select count() db1.table1) - (select count() db2.table1) t, "table1"as table) x x.t1<>0 union select * (select (select count() db1.table2) - (select count() db2.table2) t, "table2"as table) x x.t<>0
Comments
Post a Comment