I came through a intresting situationd and would request your suggestions to acheive it.
I have a table MET with columns ID,Type,Time & Session which when queried through some conditions will result sumthg like this:
ID Type Time Session
12 VS 10:58 XYZ
34 VD 10:58 XYZ
56 VK 10:58 XYZ
78 VS 11:04 ABC
90 VD 11:04 ABC
21 VS 11:10 DEF
22 VD 11:10 DEF
23 VK 11:10 DEF
So, I m concerned only pattern where VK comes in a session after VS & VD rest of them like 78 & 90 i don't care. Once VK comes i need to chk the previous row VS and make sure it has the same session as it has i.e.,XYZ equal to XYZ and DEF equal to DEF.
Please share your options to acheive it.
Thanks for your time and appreciate it.
asked Oct 02 '12 at 03:59 PM in Default
Does VS have to be the row before VK or just an ID that's less than VK for that session? If it's ok for VS and VD just to have a lower ID than VK I would do this following (if it just has to be the same session you can get rid of the 2nd AND statement in each JOIN):
answered Oct 03 '12 at 08:55 AM