Hi,I seem to be getting really confused with join types and would love a bit of advice, i'm working with a quite complicated statement which someone helped me to write a while backSELECT * FROM (SELECT P.vehicleref,P.manufacturer,P.model,P.derivative,P.additionalfreetext,P.isLimited,P.isPriceReduction,P.isSpecial, P.created, P.updated, NMF.term, NMF.milespa, NMF.maintained, NMF.ch,p.source, ROW_NUMBER() OVER ( PARTITION BY P.VehicleRef ORDER BY NMF.ch ) AS MinCH FROM ( SELECT * FROM vwAllMatrixWithLombardSimple WHERE source <> 'web') P INNER JOIN dbPubMatrix..tblNewMatrixFigures NMF ON P.VehicleRef = NMF. [VehicleRef] WHERE type='commercial' AND manufacturer='VAUXHALL') Q WHERE MinCH = 1
This query returns 5 records which is wrong. The query below gives the correct number of results - 7SELECT *FROM vwAllMatrixWithLombardSimpleWHERE (Type = 'commercial') AND (Manufacturer = 'vauxhall')
I have found, through trial and error, if I replace INNER JOIN with either LEFT JOIN or LEFT OUTER JOIN then the correct number of records are returned.Apologies if this is a really simple question but what is the difference between these join types, and is LEFT the same as LEFT OUTER?Thank you