sql - How to remove duplicates from an oracle query with multiple range values -



sql - How to remove duplicates from an oracle query with multiple range values -

i trying remove duplicates in sql query , maintain getting duplicates heres code have far

select e1.lname, w1.pno, e2.lname, w2.pno, p.plocation employee e1, employee e2, works_on w1, works_on w2, project p e1.ssn = w1.essn , e2.ssn = w2.essn , e1.ssn != e2.ssn , w1.pno = w2.pno , w1.pno = p.pnumber , p.plocation = 'houston' order e1.lname

and output

lname pno lname pno plocation borg 20 wong 20 houston borg 20 wallace 20 houston narayan 3 wong 3 houston wallace 20 wong 20 houston wallace 20 borg 20 houston wong 20 borg 20 houston wong 3 narayan 3 houston wong 20 wallace 20 houston

as can see, there rows duplicates lastly names flipped. not sure how supposed remove rows

edit: instead of putting e1.ssn != e2.ssn, changed e1.ssn > e2.ssn , got result wanted , result

lname pno lname pno plocation borg 20 wallace 20 houston wong 20 wallace 20 houston wong 3 narayan 3 houston wong 20 borg 20 houston

sql oracle

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) -