DISTINCT

B

Brad Bross

Could someone help me include a DISTINCT statement so I do not get duplicates
on the "SMTkey" field? Thx.

SELECT CIMOR_dwvStandardMeansTest.ConsumerKey,
CIMOR_dwvStandardMeansTest.ResponsibilityStartDate,
CIMOR_dwvStandardMeansTest.SMTkey
FROM CIMOR_dwvStandardMeansTest
WHERE (((CIMOR_dwvStandardMeansTest.ConsumerKey)=749649 Or
(CIMOR_dwvStandardMeansTest.ConsumerKey)=376406 Or
(CIMOR_dwvStandardMeansTest.ConsumerKey)=16578));
 
M

Marshall Barton

Brad said:
Could someone help me include a DISTINCT statement so I do not get duplicates
on the "SMTkey" field? Thx.

SELECT CIMOR_dwvStandardMeansTest.ConsumerKey,
CIMOR_dwvStandardMeansTest.ResponsibilityStartDate,
CIMOR_dwvStandardMeansTest.SMTkey
FROM CIMOR_dwvStandardMeansTest
WHERE (((CIMOR_dwvStandardMeansTest.ConsumerKey)=749649 Or
(CIMOR_dwvStandardMeansTest.ConsumerKey)=376406 Or
(CIMOR_dwvStandardMeansTest.ConsumerKey)=16578));

SELECT DISTINCT ConsumerKey,
ResponsibilityStartDate,
SMTkey
FROM CIMOR_dwvStandardMeansTest
WHERE ConsumerKey IN(749649,376406,16578)
 
J

Jerry Whittle

If you want only a unique SMTkey value to show up in each record, you'll have
to do something like below. You'll need to decide which ConsumerKey and
ResponsibilityStartDate records you want returned using functions like Max,
Min, First, Last, etc.

SELECT C.SMTkey,
Max(C.ConsumerKey),
Max(C.ResponsibilityStartDate)
FROM CIMOR_dwvStandardMeansTest as C
WHERE C.ConsumerKey= IN (749649, 376406, 16578)
GROUP BY C.SMTkey ;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top