select count(id)as ptotal,c17,c18 from eceye_contents where c17 <>'' group by c17,c18;
select count(id)as text_total,c17,c18 from eceye_contents where c17 <>''and ar_type='text' group by c17,c18;
select count(id)as text_total,c17,c18 from eceye_contents where c17 <>''and ar_type='text' group by c17,c18;
解决方案 »
- 弱弱问一个效率的问题?
- 大家帮忙看一下有没有重复的可能性?
- 50讨论ajax重用性
- 静态论坛竣工,接受斧批且开源
- 有哪位老兄帮我看看这个程序,什么结果(注释是日文,我也不知道)
- 身份证验证和银行转账的问题?
- Fatal error: Call to undefined function mysql_connect() in E:\backup\e-meeting\public_html\test.php on line 4
- 在PHP中调用函数如: fdf_create(void);总是出现Call to undefined function: fdf_create() 哪个库定议了它?
- 怎样用sql 语积句取出最后入库的记录?
- 如何判断用户输入的是中文还是英文,数字,或者是非法的字幅。
- 关于用户名限制的问题
- 诚聘WEB开发设计师:高薪+机会+空间
union all
select count(id)as text_total,c17,c18 from eceye_contents where c17 <>''and ar_type='text' group by c17,c18;
select A.ptotal,B.text_total,A.c17 as c17A,B.c17 as c17B,A.c18 as c18A,B.c18 as c18B
from (
select count(id) as ptotal,c17,c18 from eceye_contents where c17 <>'' group by c17,c18) as A,
(select count(id) as text_total,c17,c18 from eceye_contents where c17 <>''and ar_type='text' group by c17,c18) AS B
如果用union的话也可以,就是把count(id) 别名为统一名称
select count(id)as ptotal,c17,c18 from eceye_contents where c17 <>'' group by c17,c18
union all
select count(id)as ptotal,c17,c18 from eceye_contents where c17 <>''and ar_type='text' group by c17,c18
但是查询的结果似乎不是我想要的?
结果是多条union后和查询一条没什么区别