前提 oralce,mybatis
现在有多张表
我现在需要统计每张表里面的信息的数量,也就是count(*)
我现在的方法是写了多个方法
比如 mapper里:
long selectCountA;
long selectCountB;
long selectCountC;
这样的话,我要去数据库里查三次。分别获得3个数据
我想能不能 写一句sql语句 直接获得三个值
求解?
。能给我一个oracle语句的吗, 咋都是mysql。。
select A.countA,B.countB from (select count(*) as countA from t_countA) as A ,(select count(*) as countB from t_countB) as B
这样?
Mysql的select table_rows from information_schema.TABLES where table_schema in ('schema1','schema2','scheman') and table_name in ('tableName1','tableName2','tableNameN')
相信 oralce也有类似的系统表
8 回答6.5k 阅读
4 回答656 阅读✓ 已解决
2 回答3.4k 阅读
1 回答2.5k 阅读✓ 已解决
5 回答1.5k 阅读
3 回答1.9k 阅读✓ 已解决
2 回答2.2k 阅读
采用多列的写法