Alternative to Left Join
问题 I need to display the monthly rates for a fixed set of pipelines in Excel 2007 using MS Query and even if a pipeline has no monthly rate it has to be displayed in this manner I have done it using the following code in SQL Server 2008 R2. SELECT P.Name AS [Pipeline Name], PR.Id, PR.[Name], PH.[Value] AS Rate FROM [GAS].[dbo].[Pipelinerate] PR INNER JOIN Pipeline P ON P.Id = PR.Pipelineid LEFT OUTER JOIN [GAS].[dbo].[Pipelineratehistory] PH ON PH.[Pipelinerateid] = PR.[Id] AND ( PH.[Month] = ?