Hello,
I have the follow table named A:
i wish to get the pairs of drugs that belong to the same id , for example:
i try to do this with this query:
output:
i don't know how to do for to obtain only the pairs differtent, because (1,2) and (2,1) are the same, some can help me,please
thanks in advance
I have the follow table named A:
Code:
id medicine 1 1 1 2 1 3
Code:
medicine1 medicine2 1 2 1 3 2 3
Code:
select a1.medicine as medicine1, a2.medicine as medicine2 from A a1 inner join A a2 on a1.id = a2.id and a1.medicine != a2.medicine
Code:
medicine1 medicine2 1 2 2 1 1 3 3 1 2 3 3 2
thanks in advance
Comment