I would like to know if there is an easy way to join pairs of records in a single table to form one table. For example:
ID, TYPE, TIME
1, A, 01:00:00
2, B, 02:00:00
3, A, 03:00:00
4, B, 04:00:00
5, A, 05:00:00
what i would like to retreive is a single table listing the pairs (A/B) like so.
ID, TYPE, TIME, ID, TYPE, TIME
1, A, 01:00:00, 2, B, 02:00:00
3, A, 03:00:00, 4, B, 04:00:00
5, A, 05:00:00,NULL,NULL,NULL
The B record should be the next one after A, and if there is no B then just return NULL. The table shall be sorted chronigically.
TIA
Thanks ajreal, it helped me find the answer: