tags:

views:

200

answers:

0

Please bear with me new to SQL- I am trying to write an SQL command with a join in a PROGRESS db. I would like to then select only the first matching record from the join. I thought to use LIMIT but PROGRESS does not support that. MIN or TOP would also work I think but having trouble with the syntax. Here is current syntax:

SELECT esthead_0."k-est-code", estdie_0."estd-size2", estdie_0."k-cmp-no", estdie_0."estd-cal"
  FROM VISION.PUB.estdie estdie_0 
INNER JOIN VISION.PUB.esthead esthead_0 ON estdie_0."k-est-code" = esthead_0."k-est-code"
 WHERE estdie_0."k-cmp-no" = (SELECT MIN("k-cmp-no") 
                                FROM VISION.PUB.estdie estdie_0 )

This will select the MIN from the whole table but I would like the MIN of the records the join returns for each "k-est-code".