how to count multiselected queries
-
Is it possible to count rows with a multi-selected query? I have no problems counting in one table however, my real goal is to count rows of mutiple tables.
Here's a sample. This counts for one table SELECT COUNT(*) FROM table_1 WHERE condition
And what I want is to count this multiselected one: SELECT table_1.column1,table_2.column4,table_3.column7 FROM table_1,table_2,table_3 WHERE condition
Do you know how to count the rows of this one? Is it possible? Thanks! -
Is it possible to count rows with a multi-selected query? I have no problems counting in one table however, my real goal is to count rows of mutiple tables.
Here's a sample. This counts for one table SELECT COUNT(*) FROM table_1 WHERE condition
And what I want is to count this multiselected one: SELECT table_1.column1,table_2.column4,table_3.column7 FROM table_1,table_2,table_3 WHERE condition
Do you know how to count the rows of this one? Is it possible? Thanks!SELECT table_1.column1, (select count(*) from table1 as t1 where t1.col = table_1.col) as CountTable1, table_2.column4, (select count(*) from table2 as t2 where t2.col = table_2.col) as CountTable2, table_3.column7 (select count(*) from table3 as t3 where t3.col = table_3.col) as CountTable3 FROM table_1,table_2,table_3 WHERE condition
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
-
SELECT table_1.column1, (select count(*) from table1 as t1 where t1.col = table_1.col) as CountTable1, table_2.column4, (select count(*) from table2 as t2 where t2.col = table_2.col) as CountTable2, table_3.column7 (select count(*) from table3 as t3 where t3.col = table_3.col) as CountTable3 FROM table_1,table_2,table_3 WHERE condition
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.