Retreive data from table [message #372783] |
Fri, 09 March 2001 08:15 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Arpit
Messages: 99 Registered: March 2001
|
Member |
|
|
Hi,
I need to retreive some information from my 'client' table. I've clients with different client_nos. having same client_names. What I need to do is retreive this information and list all the clients with same names in an order.
Client_no Client_Name
--------- -----------
114 ABC-XYZ
256 ABC XYZ
670 ABC-XYZ
If I try to use order by it is not listing ALL clients with same names.
Please help !!!
Thanks in advance
Alpesh
|
|
|
Re: Retreive data from table [message #372786 is a reply to message #372783] |
Fri, 09 March 2001 09:34 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Tittom
Messages: 15 Registered: November 2000
|
Junior Member |
|
|
You can try something like :
select client_no, client_name
from clients a
where exists (select * from clients b
where b.client_no != a.client_no
and b.client_name=a.client_name)
order by client_name, client_no
(I did not test this)
I hope this helps
Tittom
|
|
|
Re: Retreive data from table [message #372803 is a reply to message #372786] |
Fri, 09 March 2001 14:33 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
alpesh
Messages: 3 Registered: March 2001
|
Junior Member |
|
|
Hi,
Thanks for your help. But this works only if client names are identical. What if only the client's first name is identical or have only one client with the same name.
It works for identical client names like
*Ministry of Natural Resources
*Ministry of Natural Resources
But if the table has only one record like
*Minsitry of Forestry it doesn't list.
Please help !!!
|
|
|