How to include the total number of returned rows in the resultset from SELECT T-SQL command?

前端 未结 7 1554
一整个雨季
一整个雨季 2020-12-09 09:29

I would like to ask if there is a way to include the total number of rows, as an additional column, in the returned result sets from a TSQL query using also the Row_Nu

7条回答
  •  清歌不尽
    2020-12-09 09:50

    Example using the AdventureWorks database

    select 
        *, 
        TotalVolume = (select COUNT(*) from HumanResources.Department) 
    from  HumanResources.Department
    

提交回复
热议问题