Trying to get field with the earliest date from custom object. Here is my current query
BomaGroups = [SELECT Name, Location__c FROM Group__c WHERE Location__c =:id]; // Selects the Group I want from Location Master object
MeetingsList2 = [SELECT Name, Group__c, Business_Value__c, Meeting_Date__c, GPS_Meeting_Location__Latitude__s, GPS_Meeting_Location__Longitude__s,
Group__r.Name FROM Meeting__c WHERE Group__c =:BomaGroups
ORDER BY Meeting_Date__c]; // Selects Meetings I want with the Groups SOQL as the where clause
The above queries work fine for getting 1 record that matches the WHERE clause but its supposed to return all the record matching the satisfying the WHERE clause and whose Field value for the date field is the earliest. Thought of using MIN(Meeting_Date__c) but that doesn't work with Lists, so I was thinking of an AND section in the where clause that will select earliest date, Any help would be highly appreciated still a newbie and I just cant seem to get past this one.
Let me try explain what kind of results I'm expecting: With the filter criteria as group 1,
1.Meeting 1 ,10-10-2009 , group1
2.Meeting 2 , 10-10-2009, group1
3.Meeting 3 , 10-10-2009, group1
4.Meeting 1 ,11-10-2009 ,group1
5.Meeting 1 , 12-10-2009, group1
Expected Return #1, Currently returning #1, #4, #5