first row and last row fields value from where data changed Assume I have a table like this:

I'm trying the have a output like following picture

How best to achieve this?
SELECT job_title, 
       charge_center,
       MIN(id) start_id,
       MAX(id) end_id
FROM source_table
GROUP BY job_title, charge_center;




If there exists 2 separate blocks with the same (job_title, charge_center) pair values the query will give wrong result.