I would like to create a report where I show the Supplier Name of each of our purchased parts (Table1.ProductId). I thought the report would be simple, only needing two JOINs, but my clients are complaining that an old vendor is being shown and not the current preferred vendor. I discovered a column in the second table being JOINed called "Preferred Vendor" so I have a field to tell me which row to follow in the JOIN, but the JOIN is choosing to follow the "Supplier" with the lowest value.
SQL
SELECTTable1.ProductDescription,Table3.SupplierNameFROMTable1LEFTJOINTable2ONTable1.Product=Table2.ProductLEFTJOINTable3ONTable2.Supplier=Table3.SupplierWHERETable1.ProductId=@Product
But as you can see from the image above, the JOIN is choosing the wrong one. The report chooses...