MSSQL add count column near existing select columns

Posted by Luis on Stack Overflow See other posts from Stack Overflow or by Luis
Published on 2011-01-03T10:49:46Z Indexed on 2011/01/03 10:54 UTC
Read the original article Hit count: 234

Filed under:
|
|

Hi, i have a query that returns something like this.

ID | Company| Total_Money | no_items | count_Total_Money_For_Company
-----------------------------------------------------------
1 | A | 1000 | 1 | 2001
2 | A | 1001 | 0 | 2001
3 | B | 1001 | 1 | 5010
4 | B | 1002 | 1 | 5010
5 | B | 1003 | 1 | 5010
6 | B | 1004 | 1 | 5010
7 | B | 1000 | 1 | 5010

How can i add that column with the count for that company?

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server