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

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -