Faire une requête SQL

Résolu
Sarah -  
 Sarah -
TABLE
| ID | P1 | P2 |
| A | 1 | 2 |
| B | 1 | 2 |
| C | 1 | 2 |
| C | 2 | 1 |
| C | 1 | 3 |

Code à convertir en SQL :
For (int i=0; i<Count.line; i++)
{
For (int j=0; j<Count.line; j++)
{
If (line[i].ID = line[j].ID && line[i].P1 = line[j].P2 && line[i].P2 = line[j].P1)
{
Show(line[i]);
}
}
}

Comment faire ce code ???
SELECT *
FROM TABLE...

Voici se que je souhaite obtenir en résultat :
| C | 1 | 2 |
| C | 2 | 1 |

Merci à vous la communauté !

2 réponses

yg_be Messages postés 24281 Statut Contributeur Ambassadeur 1 584
 
bonjour, moi j'essayerais:
select t1.* 
from table as t1, table as t2
where 
t1.ID = t2.ID and t1.P1 = t2.P2 and t1.P2 = t2.P1
1
Sarah
 
Merci pour ta réponse yg_be, cela m'a permis de trouver !
0