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
 Sum query

Author  Topic 

masond
Constraint Violating Yak Guru

447 Posts

Posted - 2012-12-19 : 06:02:57

Hey guys

Really stupid question but need some help

This is my query,

SELECT 'Foreign -issued cards total Transactions and Gross Sales',
SUM([hst_sales_tran_R12]) AS [Transactions],
SUM([hst_sales_amt_R12]) AS [Gross Sales]
FROM [Fact_Financial_History_2] INNER JOIN Dim_Interchange_Tier_2 ON
Fact_Financial_History_2.hst_prod_code + '-' + Fact_Financial_History_2.hst_plan_code = Dim_Interchange_Tier_2.Plan_Code
WHERE Region in ('EU', 'INT')
GROUP BY Dim_Interchange_Tier_2.region


When i run the query it is producing the following results

(No column name) Transactions Gross Sales
Foreign -issued Sales 2554838 228653784.13
Foreign -issued Sales 2178699 228165015.92

Is there anyway i can get them transactions/gross sales to be on a one liner ?

For instance
(No column name) Transactions Gross Sales
Foreign -issued Sales 4733537 456818800.1

Would appreciate any help available






bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-12-19 : 06:39:06
Try this...

WHERE Region in ('EU', 'INT')
GROUP BY Dim_Interchange_Tier_2.region



--
Chandu
Go to Top of Page
   

- Advertisement -