一条sql语句返回多个count值
SELECTproduct_id,team_id,count(team_id)assum,count(product_id)assum1FROM`hits`WHERE(`...
SELECT product_id,team_id,count(team_id) as sum,count(product_id) as sum1 FROM `hits` WHERE (`create_time`>= '1415203200' AND `create_time` <= '1415264663') GROUP BY `team_id`,`product_id` ORDER BY `sum` DESC LIMIT 0,15
第二个group by 被忽略了,为什么,该怎么解决这个问题 展开
第二个group by 被忽略了,为什么,该怎么解决这个问题 展开
1个回答
展开全部
你是说order by 忽略了吧
select * from (
SELECT product_id,team_id,count(team_id) as sum,count(product_id) as sum1 FROM `hits` WHERE (`create_time`>= '1415203200' AND `create_time` <= '1415264663') GROUP BY `team_id`,`product_id`
)x
ORDER BY `sum` DESC LIMIT 0,15
select * from (
SELECT product_id,team_id,count(team_id) as sum,count(product_id) as sum1 FROM `hits` WHERE (`create_time`>= '1415203200' AND `create_time` <= '1415264663') GROUP BY `team_id`,`product_id`
)x
ORDER BY `sum` DESC LIMIT 0,15
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询