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.
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 TotalRecordsFROM cmp_Everything AS eeWHERE (Cmonth = N'March2013')GROUP BY CompanyNameselect ee.CompanyName, SUM(CASE Last WHEN 'EE002' THEN SuccessValue * 1 WHEN 'EE003' THEN SuccessValue * 1 WHEN 'EE004' THEN SuccessValue * 1 ELSE SuccessValue END) AS TotalSalesFROM cmp_Everything AS ee INNER JOIN History AS h ON ee.DID = h.DID INNER JOIN EECRCSuccessValues ON h.CRC = EECRCSuccessValues.CRCWHERE (ee.Cmonth = N'March2013')GROUP BY ee.CompanyNameSELECT ee.CompanyName, COUNT(CRC.Contact) AS TotalDFROM cmp_Everything AS ee INNER JOIN History AS h ON ee.DID = h.DID INNER JOIN CRC ON h.CRC = CRC.CRCWHERE (CRC.Contact = 1) AND (ee.Cmonth = N'March2013')GROUP BY ee.CompanyNameI Want to combining the above into one select query |
|
|
|
|