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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Total Row count on each row

Author  Topic 

Grifter
Constraint Violating Yak Guru

274 Posts

Posted - 2012-03-02 : 11:05:27
Hi

I have a query like this:

Select a,b,c,d
from a
union
select a,b,c,d
from b
union
Select a,b,c,d
from c


And would like to have my returned data set like this:

a   b    c   d   TotalrowCount
= = = = =============
- - - - 30
- - - - 30
- - - - 30
- - - - 30
- - - - 30
- - - - 30
- - - - 30
- - - - 30
- - - - 30
- - - - 30

Lets just say I have 30 rows I want to display this on every row.

Any ideas would be great

Thanks

G

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-02 : 11:24:10
[code]SELECT ....., TotalrowCount = count(*) over()[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Grifter
Constraint Violating Yak Guru

274 Posts

Posted - 2012-03-02 : 12:01:49
Ok thanks
Have not had time to try this yet but will reply with findings

G
Go to Top of Page
   

- Advertisement -