MySql多列查询

SELECT
(
 SELECT count(1) from `cti_interchringlen` where TimeLens > 0 and TimeLens<= 4 and `Date`='2012-01-12' and  AgentName  ='1004' order by count(1) desc
) as '[0-4]',
(
 SELECT count(1 ) from `cti_interchringlen` where TimeLens > 4 and TimeLens<= 6 and `Date`='2012-01-12' and  AgentName  ='1004'
) AS '[4-6]',
(
 SELECT count(1) from `cti_interchringlen` WHERE TimeLens > 6 and TimeLens<= 8 and `Date`='2012-01-12' and  AgentName  ='1004'
 )AS '[6-8]'

posted @ 2012-03-20 22:06  Elite_Y  阅读(2730)  评论(0编辑  收藏  举报