In SQL , i want to retrieve the first three persons (marked with a tick) because they have activities that follow each other (FR, ISRO, VIS, REC) in sequence order dates. The last two persons (4 and 5) must not appear because 4 starts with DC and 5 has DE as the second last activity instead of VIS.
Please note that there can be other activities in between the history of these persons. But the idea is that if there is FR and after that it is followed by ISRO and after that by VIS and after that by REC, then this person must show up. NB (even if there might be other activities between them.
Please help with the code.
The pseudocode is:
FROM Person LeftJoin History On Person.person_id = History.person_id
Where ActivityName = FR followed-by ISRO followed-by VIS followed-by REC
even if there can be other activities between them.
Yeah it is ok , i just need the skeleton SQL code to select an item , and make sure it followed by something(FR), and followed by something(ISRO) , and followed by something(VIS), and followed by something(REC) using the sequence order date to compare them.
This information is in our company server, it look exactly like what i put on the picture, all i need is skeleton code of selecting items satisfying the condition that they are preceded with other items.
and all we need is for you to provide sample data to try it out on our server. or give us access to your server its very simple. provide sample data you have attached as a picture in the following format
You need to understand. We are volunteering to write code for you, to solve your problem, and we do it for many other people during the day too. I just don't have time to create sample data for everyone's issue.
You expect each of us to do it for you. But, if it's your issue, and you don't do it, then how important is it really?