help me urgent [message #21668] |
Wed, 21 August 2002 20:15 |
sha
Messages: 84 Registered: July 2002
|
Member |
|
|
Hi,
If I want to retrieve rows from two tables eliminating duplicate values.
I have to retrieve the table name from tab table and the corresponding values of that table in another table.I am getting duplicate values,even I used distinct command.
e.g.
If I want to retreive the employees information where I ahve to count the number of records.
select distinct a.tname,b.deptno,count(b.ename) from tab a,emp b where a.tname like '%EM%' group by b.deptno,a.tname
thanx in advance
|
|
|
|
Re: help me urgent [message #21714 is a reply to message #21668] |
Sun, 25 August 2002 07:09 |
Su
Messages: 154 Registered: April 2002
|
Senior Member |
|
|
First of all, your query does not work as it is not related and there is no join relation. Tab is a view which shows the list of tables existing in your schema and the one you want to retrieve employee information from is either a physical data table (called EMPLOYEE etc) or a view created on it. Since there is no link and join criteria, it gives you a cartesian product which shows the rows repeatedly.
A question, why are you comparing both these tables any way?
Check it out.
Good luck :)
|
|
|