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
Randy BruckRandy Bruck 

Grouping query results by date in a pageblocktable

I have a custom object that tracks "breaks" in a Campaign. I have a query that returns all the records associated with the Campaign, but I would like to separate them into table blocks by each unique date (not knowing what the dates will be ahead of time).My query:

public List<brk__c> getBreak() {
        return [
        SELECT Break_Number__c, 
               Break_Date__c, 
               Start_Text__c,
               End_Text__c, 
               Minutes__c, 
               Program__c,
               Challenge__c,
               Type__c
          FROM brk__c   
         WHERE Campaign__c =: campId
         ORDER BY Break_Date__c ];
    }

And I have one table that looks like this:
User-added imageWhat I want is a table for each set of records with the same date. Any help appreciated.
VinayVinay (Salesforce Developers) 
Hi Randy,

Check below examples of grouping query results.

https://blog.jeffdouglas.com/2011/03/02/dynamically-group-display-query-results/
https://developer.salesforce.com/forums/?id=906F0000000992RIAQ

Thanks,