I have the following columns in a table tbl:
OrderID: Parent: Child:
1 1 1
2 2 1
3 1 2
4 1 1
5 2 1
I wanted to get the current (OrderID,Parent,Child) and the LOWER (OrderID,Parent,Child) WHERE Parent and Child is equal to the current OrderID’s Parent and Child.
So, for example if I have a query for OrderID=4 the result should be the following:
OrderID: Parent: Child:
4 1 1
1 1 1
and if OrderID=5
OrderID: Parent: Child:
5 2 1
2 2 1
BTW, I can do this in PHP but I wanted to do it in a single query.
Okay, thanks all for your replies but I got my own answer.