function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
James_DeanJames_Dean 

distinct query problem

I have a custom table which has a textfied of size 6 that holds a date and month information in the format YYYYMM. What i wanted was a query like this "select distinct date from Commission__c" but i cannot because there is no distinct or group by function in soql.....any workaround?
ShamSham
you can try using the set datastructure of Apex.

Set<Date> setDate  = new Set<Date>();
for(Commission__c commission :[SELECT Date__c from Commission__c]) {
  setDate.add(commission.Date__c);
}

//Now your set contains distinct date records.