Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-12-12 : 07:19:56
|
Jonas writes "Jonas writes "Hi,I need to return total rows in a subquery.Example.SELECT col1, col2, TotalRowsInSubQuery FROM ( SELECT col1, col2 FORM tbl1) as mySubQueryTableWHERE col1 = 2 TotalRowsInSubQuery should return the amount of rows affected by the select in the subquery.(if mySubQueryTable has 10posts, TotalRowsInSubQuery should also be 10)TIA!" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-12 : 07:33:28
|
| You need to make use of CountSELECT col1, col2, TotalRowsInSubQuery FROM (SELECT col1, col2,Count(*) as TotalRowsInSubQuery FORM tbl1 group by col1,col2) as mySubQueryTableWHERE col1 = 2MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|