首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在同一表格的同一网格视图中使用五种不同的SQl查询

如何在同一表格的同一网格视图中使用五种不同的SQl查询
EN

Stack Overflow用户
提问于 2014-04-09 20:39:59
回答 1查看 51关注 0票数 0

如何在同一网格视图中使用具有不同参数的同一表中的五个不同的SQl查询

代码语言:javascript
运行
复制
select count(distinct callingnumber) as UniqueCaller,count(callingnumber) as      numberOfCall from FCR1  where callnumberpercallreason >15;

select count(distinct callingnumber) as UniqueCaller,count(callingnumber) as numberOfCall from FCR1  where callnumberpercallreason between 2 and 6 and callreasonname='Mobile/GSM>VAS-CRBT>CRBT Service Deactivation';

=========output============

代码语言:javascript
运行
复制
Calling frequency   Unique Caller   No of Call
15                  7               116
B/n 14-11           11              133
B/n 10-8            50              412
B/n 7-2             8528            20635
One Times           46219           46219
Total               54815           67515
EN

回答 1

Stack Overflow用户

发布于 2014-04-23 00:01:39

如果您的列相同,则可以在两个查询之间使用union,如下所示:

代码语言:javascript
运行
复制
select count(distinct callingnumber) as UniqueCaller,count(callingnumber) as      numberOfCall from FCR1  where callnumberpercallreason >15;
union
select count(distinct callingnumber) as UniqueCaller,count(callingnumber) as numberOfCall from FCR1  where callnumberpercallreason between 2 and 6 and callreasonname='Mobile/GSM>VAS-CRBT>CRBT Service Deactivation';

如果您的列不同,则可以为不同的列创建空白,例如:

代码语言:javascript
运行
复制
 select col1, col2, col3 from table1
 union
 select col1, '', col4 from table2
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22962836

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档