Click here to Skip to main content
15,177,264 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
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
Posted
Updated 5-Feb-13 23:26pm
v2

It works
SQL
select ((select COUNT(*) from history) + (select Count(*) from appointment_info)+(select COUNT(*) from DailyIncome))
   
Comments
Ankur\m/ 6-Feb-13 4:50am
   
[moved from answer]
Ripal Merakinfoway wrote:
but this query are give me a sum of three table but i have answer like 20 25 20
Ripal Merakinfoway wrote:
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:
SQL
SELECT ( CONVERT(VARCHAR, (SELECT COUNT(*) FROM history)) + ' ' + CONVERT(VARCHAR, (SELECT COUNT(*) FROM appointment_info)) + ' ' + CONVERT(VARCHAR, (SELECT COUNT(*) FROM DailyIncome)) )
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900