Does SOQL support the distinct keyword?
|Knowledge Article Number||000187432|
|Description||Often times, the need to utilize the distinct functionality in a query arises. This is a common keyword in SQL, but SOQL doesn't have the distinct functionality. However, there are a few suitable workarounds.|
|Resolution||This concern has actually been voiced on the Idea Exchange: https://success.salesforce.com/ideaView?id=08730000000Brr2AAC
The distinct functionality can be utilized either through the "group by" keyword or via a semi-join query, as in the following example:
[select name from contact where id in (select contactId from case where priority = 'high')]