Having a bit of trouble with this sql.It's bring back too many rows.The problem is the reference table.This table has information on each revision, so, it returns all revisions.SELECT QuoteName, MAX(i.revision) revision, i.ItemName, AS 'XrefID',ref.ID AS 'XrefID' --if this is removed, correct num of rows returnedFROM Items i LEFT OUTER JOIN PriceQty q ON q.itemid = i.rowIDINNER JOIN PriceRef ref ON ref.PriceQtyID = q.rowidGROUP BY QuoteName, i.ItemName, ref.IDORDER BY QuoteName DESC
I know I'm not seeing something obvious here so an extra set of eyes would be helpful.Thanks