fork download
  1. create table t
  2. (
  3. name char(3),
  4. part char(3)
  5. );
  6.  
  7.  
  8. insert into t
  9. (name, part)
  10. values
  11. ("aaa", "pt1");
  12. insert into t
  13. (name, part)
  14. values("aaa", "pt2");
  15. insert into t
  16. (name, part)
  17. values("aaa", "pt3");
  18. insert into t
  19. (name, part)
  20. values("bbb", "pb1");
  21. insert into t
  22. (name, part)
  23. values("bbb", "pt3");
  24. insert into t
  25. (name, part)
  26. values
  27. ("ccc", "pt2");
  28.  
  29. select a.name, a.part, b.part from t as a inner join t as b on a.name = b.name where a.part < b.part;
  30.  
Success #stdin #stdout 0s 2964KB
stdin
Standard input is empty
stdout
aaa|pt1|pt2
aaa|pt1|pt3
aaa|pt2|pt3
bbb|pb1|pt3