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
 Basic sum help

Author  Topic 

masond
Constraint Violating Yak Guru

447 Posts

Posted - 2012-09-13 : 06:50:48
Hi guys

a quick basic question

My query is producing two separate columns

Instead of having two separate columns is it possible that it can be counted as one ?

This is my query


SELECT
COUNT(FDMSAccountNo),
COUNT(Distinct Corp_Chain_No)
From Dim_Outlet

this is current layout
(No column name) (No column name)
151343 1087

I am after
(No column name)
152430

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-09-13 : 06:52:00
You could simply add the two as in:
SELECT COUNT(FDMSAccountNo)+
COUNT(DISTINCT Corp_Chain_No)
FROM Dim_Outlet
Go to Top of Page

masond
Constraint Violating Yak Guru

447 Posts

Posted - 2012-09-13 : 06:56:00
Sunitabeck ,

I told you it was a simple problem

Dont you hate when your brain is dead, and you know you can solve the problem, but you cant think of the answer ! and you do these basic problems all day ! Frustrating.com :P
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-09-13 : 07:06:30
Happens to all of us, but that is what SQLTeam is here for, isn't it?
Go to Top of Page
   

- Advertisement -