Group by in Progress

lhowell

New Member
I'm new to progress coming from a SQL background. I need to complete the following in Progress. Here is how it would be written in SQL

SELECT orders.customerID from orders
group by customerID

How do you do grouping in progress? How would the above be written to get a list of the customers?
 

tamhas

ProgressTalk.com Sponsor
Look up adding Break By to the for each and then use First-Of() or Last-Of or both to get only one record for each unique Break By key. You can also use this to do things like getting totals for the customer and the like.
 

Cringer

ProgressTalk.com Moderator
Staff member
Here's the above suggestion for you to help you find what you're looking for.

SELECT orders.customerID from orders
group by customerID

Code:
FOR EACH orders NO-LOCK
  BREAK BY customerID:
  IF FIRST-OF(customerID) THEN
    DISPLAY customerID.
END.
 
Top