Need suggestiong in grouping related items by representing a flag

Database
Enthusiast

Need suggestiong in grouping related items by representing a flag

Hi,

I have a scenario where i need to pull some conecting records and highlight them with proper flags to mention to which it belongs to.

Below is the sample input data and exepected output.


Input:
AC|FN|SSC|StartDate|StartTime|SEC|EndDate|EndTime|EffectiveDate|DiscontinueDate
PR |127|JFK|04/11/2017|00:15:00|YVR|04/11/2017|03:30:00|04/11/2017|12/31/9999|
PR |127|YVR|04/11/2017|05:15:00|MNL|04/12/2017|07:40:00|04/11/2017|12/31/9999|
PR |127|JFK|04/12/2017|00:15:00|YVR|04/12/2017|03:30:00|04/11/2017|12/31/9999|
PR |127|YVR|04/12/2017|05:15:00|MNL|04/13/2017|08:55:00|04/11/2017|12/31/9999|
PR |127|MNL|04/12/2017|21:35:00|QPX|04/12/2017|22:35:00|04/11/2017|12/31/9999|

 

Output:
AC|FN|SSC|StartDate|StartTime|SEC|EndDate|EndTime|EffectiveDate|DiscontinueDate|FLAG(Some)
PR |127|JFK|04/11/2017|00:15:00|YVR|04/11/2017|03:30:00|04/11/2017|12/31/9999|1|
PR |127|YVR|04/11/2017|05:15:00|MNL|04/12/2017|07:40:00|04/11/2017|12/31/9999|1|
PR |127|MNL|04/12/2017|21:35:00|QPX|04/12/2017|22:35:00|04/11/2017|12/31/9999|1|
PR |127|JFK|04/12/2017|00:15:00|YVR|04/12/2017|03:30:00|04/11/2017|12/31/9999|2|
PR |127|YVR|04/12/2017|05:15:00|MNL|04/13/2017|08:55:00|04/11/2017|12/31/9999|2|

 

Thanks,
Mallesh

Tags (1)
1 REPLY
Senior Apprentice

Re: Need suggestiong in grouping related items by representing a flag

You know what you want, but nobody else.

Please explain your rules in detail.