Sql server子查询.............. [英] Sql server Subquery..............

查看:68
本文介绍了Sql server子查询..............的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i有三个表像feedback_tbl,contact_tbl,new_connection_tbl

我的问题是如何使用子查询

hi
i have three table like feedback_tbl,contact_tbl,new_connection_tbl
and my question is how to count this table record in one column using subquery

推荐答案

工作原理

It works
select ((select COUNT(*) from history) + (select Count(*) from appointment_info)+(select COUNT(*) from DailyIncome))


Ripal Merakinfoway写道:
Ripal Merakinfoway wrote:

但是这个查询给了我一个三个表的总和,但我的答案就像20 25 20

but this query are give me a sum of three table but i have answer like 20 25 20



在这种情况下,将查询更改为:


In that case, change the query to:

SELECT ( CONVERT(VARCHAR, (SELECT COUNT(*) FROM history)) + ' ' + CONVERT(VARCHAR, (SELECT COUNT(*) FROM appointment_info)) + ' ' + CONVERT(VARCHAR, (SELECT COUNT(*) FROM DailyIncome)) )


这篇关于Sql server子查询..............的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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