Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sum query
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

447 Posts

Posted - 12/19/2012 :  06:02:57  Show Profile  Reply with Quote

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

Flowing Fount of Yak Knowledge

2242 Posts

Posted - 12/19/2012 :  06:39:06  Show Profile  Reply with Quote
Try this...

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

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000