SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 combining multi select query into one
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tyekhan
Starting Member

28 Posts

Posted - 04/20/2013 :  10:01:22  Show Profile  Reply with Quote
I need help on the following I need 10 column in to one query output,

So the single query are as below,

SELECT CompanyName, COUNT(CompanyName) AS TotalRecords
FROM cmp_Everything AS ee
WHERE (Cmonth = N'March2013')
GROUP BY CompanyName

select ee.CompanyName,
SUM(CASE Last WHEN 'EE002' THEN SuccessValue * 1 WHEN 'EE003' THEN SuccessValue * 1 WHEN 'EE004' THEN SuccessValue * 1 ELSE SuccessValue END) AS TotalSales
FROM cmp_Everything AS ee INNER JOIN
History AS h ON ee.DID = h.DID INNER JOIN
EECRCSuccessValues ON h.CRC = EECRCSuccessValues.CRC
WHERE (ee.Cmonth = N'March2013')
GROUP BY ee.CompanyName

SELECT ee.CompanyName, COUNT(CRC.Contact) AS TotalD
FROM cmp_Everything AS ee INNER JOIN
History AS h ON ee.DID = h.DID INNER JOIN
CRC ON h.CRC = CRC.CRC
WHERE (CRC.Contact = 1) AND (ee.Cmonth = N'March2013')
GROUP BY ee.CompanyName


I Want to combining the above into one select query
  Previous Topic Topic Next Topic  
 New 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.06 seconds. Powered By: Snitz Forums 2000