I need to write a query to produce a result like below.
Anyone has any ideas??
Yes... You've been around long enough to know that if you want coded help, that you need to post readily consumable data instead of graphics. Please read and heed the article at the 1st link in my signature line be for why and one way how to do such a thing.
I have some ideas – they involve GROUP BY and MAX(). You have nearly 4,000 points and this is simple stuff. What have you tried so far?
I don't think it is that simple. There are 2 different sections of the initial data table containing Plan 20000479 and 20027778. The OP wants them separated into different sections and not grouped together just by the order he has displayed them. Yet there is nothing in this table to separate the same plan other than the position that they have been displayed in his picture.