Home » SQL & PL/SQL » SQL & PL/SQL » Duplicate Rows (10G)
Duplicate Rows [message #328071] Wed, 18 June 2008 16:57 Go to next message
apps_ara
Messages: 29
Registered: January 2007
Location: Pune
Junior Member
Hi,
I have three tables
1.Dept(deptno,dname,area_name)
2.Emp(Ename,deptno)
3.Area(Area_name,deptno)
when i execute the query
select deptno,ename,area_name from emp,dept,area
where emp.deptno=dept.deptno and dept.deptno=area.deptno
My output shows something like this:

Deptno Ename Area_name
--------------------------
10 Scott US
10 Scott UK
20 Greg Eur
20 Mark UK
20 Greg US
20 Mark Eur
20 Greg UK
20 Mark US

What I am looking for is :
Deptno Ename Area
--------------------------
10 Scott US
10 Scott UK
20 Greg Eur
20 Mark UK
20 US

Please let me know if find the solution for the above issue.
Thankyou,
Anita
(PS: This is just a pseudo code for my situation in Advanced Product Catalog tables. To make it understand simpler, i used the above tables.
)
Re: Duplicate Rows [message #328072 is a reply to message #328071] Wed, 18 June 2008 17:03 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above

The (over)simplification make NO sense & you neglected to explain the logic behind the desired output.

http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above
Re: Duplicate Rows [message #328098 is a reply to message #328071] Wed, 18 June 2008 23:09 Go to previous messageGo to next message
Michel Cadot
Messages: 64140
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

With what you said there is only one answer: fix your query, check your join conditions.

Regards
Michel
Re: Duplicate Rows [message #328114 is a reply to message #328071] Wed, 18 June 2008 23:54 Go to previous message
saikumar_mudigonda
Messages: 23
Registered: June 2008
Location: hyderabad
Junior Member
Pls provide more info in specified format by this fourm, try to provide always the table data as well, which will be more useful to understand your question.
Previous Topic: PL/SQL help needed to loop through tables
Next Topic: CURSOR & REF CursoR
Goto Forum:
  


Current Time: Fri Dec 09 06:03:01 CST 2016

Total time taken to generate the page: 0.09281 seconds