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
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 combining multi select query into one

Author  Topic 

tyekhan
Starting Member

29 Posts

Posted - 2013-04-20 : 10:01:22
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
   

- Advertisement -