select the first row of a column in a group of rows within another column

You can use row_number()

select * from
  SELECT *,row_number() over(partition by code order by month) as rnk
  FROM Table_Example cxp
  WHERE plan = '2600C'
)A where rnk=1

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top