The query below when run returns multiple rows of duplicated s.SAMPNUM. I need it to return just one of each samp num. If I was to remove the inner joins it does this, but I need to keep
the inner joins as the columns brought in by them are needed.
How can I get it to return one of each s.SAMPNUM?
select distinct s.SAMPNUM, s.DESCRIPTN, s.SUITE, s.TYPE, r.DET, r.Result, r.GenFlag, r.SpecFlag, l.HISPEC, l.LOSPEC, l.TARGETSPEC from Samples s (nolock)
inner join Results r on s.SAMPNUM = r.SAMPNUM
inner join LimitAttributes l on s.SUITE = l.Suite and r.DET = l.DET
where LogDate >= '08/01/2010' and LOGDATE <= '10/15/2010' and CLIENT = 'SIS' and EOL = 0 and SHELFNUM = 0 and BATCH != 'EOL' and RETAILER like '%Swab%' and r.SpecFlag = 1
Many thanks, Matt
View Complete Post