I need to know the data type for your date and time columns to know the best way to finish the last two columns. Since that's not in the question, here's the rest of it, which is enough to get you started:
select [Production order]
, MIN(PN) as PN
, MIN(ProjectID) as ProjectID
, MIN([Drawing No]) as [Drawing No]
from TIMEDATA1
group by [Production order]
order by [Production order] asc
I also noticed this:
PN, ProjectID, Drawing No should be unique value also .That can get from first row or any.
This is also a common requirement, but it's really poor report design, because it's very easy to end up showing data that doesn't make sense.
For example, looking at the sample result data we see these values for production order, drawing, and end time:
MA-000001FAB, 2A, 2019-09-23 16:51:19.000
However, looking at the original data for drawing 2A
we can see this end time is not associated with that drawing. In other words, this is data that doesn't make any sense to show side-by-side. It's your job to know this and either push back against that kind of requirement or understand how to expand it to show the correct row.
If you must settle for this poor requirement, it's better to do something like this:
select *
from (
select [Production order], PN, ProjectID, [Drawing No]
, row_number() over (partition by [production order] order by [production order], end_date, end_time) as rn
from TIMEDATA1
) t1
where rn = 1
order by [production order]
This way, at least all of the random values will come from the same row, and it will be the row that matches the min end date and time.