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
Post a Comment