Skip to content
Advertisement

Appending Name based on Min and Max datetime

I have Event_No, Events, Date Range in my table like below.

I need to show Min datetime respective Event name with ‘IN'(a concatenation of (Event-‘IN’))and Max datetime respective Event with Out(a concatenation of (Event-‘Out’)). I need My Final Output like below

Thanks

Advertisement

Answer

This is a gaps and islands problem.

This puts the values on one row, which might meet your needs.

You can also use lead() and lag():

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement