这个SQL查询没有任何帮助? [英] This sql query doesn't work any help?

查看:55
本文介绍了这个SQL查询没有任何帮助?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Select *
From
(
Select new_do_presentation,COUNT(new_do_presentation) as presentation
from FilteredNew_dineintakeawaycommentcard
where createdon > '7/25/2011'
and createdon <'7/27/2011'
Group by new_do_presentation


UNION

Select new_do_temperature,COUNT(new_do_temperature) as temperature
from FilteredNew_dineintakeawaycommentcard
where createdon > '7/25/2011'
and createdon <'7/27/2011'
Group by new_do_temperature

UNION

Select new_do_taste,COUNT(new_do_taste) as taste
from FilteredNew_dineintakeawaycommentcard
where createdon > '7/25/2011'
and createdon <'7/27/2011'
Group by new_do_taste
)AS tab
Group by new_do_taste, new_do_temperature,new_do_presentation;





真正的问题是,此查询通过重复进行选择(即使我使用分组依据)(当我在同一张表中选择时,每个任务正常工作也会产生此问题)


我需要从X表中选择3列(此列包含YES或No值),然后我需要查看每个列包含yes和no的次数.





The real Problem is that this query make select with repetition(Even I use Group By)(every task Work normaly when i selected in the same table make this problem)


What i need is to select 3 columns from X tables (this columns contain YES Or No values)then i need to see each columns how many times contain yes and no

推荐答案

您不会说不起作用"是什么意思,而是接受每个子查询并确认它是否给您您期望的结果,然后,当您知道什么起作用和什么不起作用时,请向我们解释问题是您是否需要帮助.
You don''t say what ''does not work'' means, but take each subquery and confirm if it gives you what you expect, then, when you know what works and what doesn''t, explain to us what the issue is if you want help.


这篇关于这个SQL查询没有任何帮助?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆