How to get rid of duplicated lines in SQL Cross Join Query result? -



How to get rid of duplicated lines in SQL Cross Join Query result? -

i have person table:

to list of persons have difference between ages less 5 years, try:

select * person p1 cross bring together person p2 p1.psn_id <> p2.psn_id , p1.psn_age - p2.psn_age <= 5;

so got:

as can see, sec line same first. question how rid of duplicated line?

select * person p1 cross bring together person p2 p1.psn_id < p2.psn_id , abs(p1.psn_age - p2.psn_age) <= 5;

sql

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -