Hi -I have three tables that I am trying to join in order to produce some report output. I have tried numerous ways, but they all don't give the results I need to provide.Below is the table creation, some inserts for data and the output I am looking for.CREATE TABLE [SalesAcct] ( [EmpName] [varchar] (100), [Acct_Num] [varchar](15), [Acct_Name] [varchar] (50) )CREATE TABLE [Perf] ( [Acct_Num] [varchar](15), [PerfDate] [smalldatetime], [Channel] [varchar](25), [Medium] [varchar](25), [Clicks] [int], [Impressions] [int] )CREATE TABLE [Revenue] ( [Acct_Num] [varchar](15), [RevenueDate] [smalldatetime], [Channel] [varchar](25), [Medium] [varchar](25), [ServiceLevel] [varchar], [TransactionType] [varchar], [GrossRev] [decimal](18, 2) )INSERT INTO SalesAcct (EmpName, Acct_Num, Acct_Name) VALUES ('BobSmith', '100XYZ', 'My Account')INSERT INTO Perf (Acct_NUm, PerfDate, Channel, Medium, Clicks, Impressions) VALUES ('100XYZ', '05-11-2008', 'US', 'Net', 240, 500)INSERT INTO Revenue (Acct_Num, RevenueDate, Channel, Medium, GrossRev) VALUES ('100XYZ', '05-11-2008', 'US', 'Net',500.50)INSERT INTO Revenue (Acct_Num, RevenueDate, Channel, Medium, GrossRev) VALUES ('100XYZ', '05-11-2008', 'US', 'Cable',23.75)What I need to provide to mgmt is two reports...one is rolled up by EmpName and AcctNum and Date, and the other is details like:Suumary_Acct_By_Day:EMPName | Acct_Num | Acct_Name | Date Rev $ | Clicks | ImpressionsBobSmith| X0000005 | My Account | 2008-05-11 | 524.25 | 240 500 Detail_Acct_By_Day:EMPName | Acct_Num | Channel | Medium | Date | Rev $ | Clicks | ImpressionsBobSmith | X0000005 | US | Net | 2008-05-11 | 500.50 |240 | 500 BobSmith | X0000005 | US | Cable | 2008-05-11 | 23.75 | 0 | 0My latest query, which doesn't work is:select S.EmpName, S.acct_num, R.RevenueDate as Date, coalesce(R.Channel, P.channel)as channel, coalesce(R.medium, P.medium), GrossRev, coalesce(P.clicks, ''), coalesce(P.impressions, '') FROM SalesAcct AS S left outer join Revenue as R on S.acct_num = R.acct_num left outer join Perf as P on S.acct_num = P.acct_num
Yields two rows...but the Medium duplicates and the Clicks and Impressions also get duplicated when they should be zero.Any help would be appreciated.Thank you, Will