seakingx
金牌会员
 
UID 75142
精华
0
积分 1267
帖子 801
金钱 663 喜悦币
威望 0
人脉 604
阅读权限 70
注册 2006-6-18 来自 海口
状态 离线
|
[推荐阅读] php能否读写二进制的DAT文件
mysql> select * from data;
+------+------+
| gid | name |
+------+------+
| 1 | a |
| 1 | b |
| 2 | xx |
| 3 | yy |
| 1 | dd |
+------+------+
5 rows in set (0.00 sec)
mysql> select * from data1;
+------+------+
| gid | name |
+------+------+
| 3 | yy |
| 1 | yy |
| 2 | yy |
| 1 | cc |
+------+------+
4 rows in set (0.02 sec)
mysql> select sum(cnt) cnt ,sum(cnt1) cnt1 from (
-> select count(1) cnt , 0 cnt1 from data where gid=1
-> union
-> select 0 cnt , count(1) cnt1 from data1 where gid=1) A1;
+------+------+
| cnt | cnt1 |
+------+------+
| 3 | 2 |
+------+------+
1 row in set (0.01 sec)
|  锐升科技 |
|