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 |
SimonG
Starting Member
15 Posts |
Posted - 2010-02-09 : 12:37:52
|
Hi,New to the forum and would appreciate if anyone can guide me on the best way to achieve the following;I've got a table created by a DTS package that exports a list of transactions. Each transaction has a contract, a posting date and a value;CW031,30/1/2010,25.00CW031,30/1/2010,35.00CW032, 30/1/2010,75.00CW034, 30/12/2009, 65.00I basically need to query this and produce a line for the aggregate value for each contract in each period;CW031, 1/2010, 60.00CW032, 1/2010, 75.00CW034, 12/2009, 65.00What's the best way to achieve this?Regards,Simon |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-09 : 12:46:40
|
[code]SELECT contract,date,SUM(value) AS totalFROM TableGROUP BY contract,date[/code] |
|
|
SimonG
Starting Member
15 Posts |
Posted - 2010-02-10 : 04:16:50
|
Thanks - I appreciate your posting.Works a treat!Simon |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-10 : 04:24:34
|
welcome ------------------------------------------------------------------------------------------------------SQL Server MVP |
|
|
|
|
|
|
|