Home » RDBMS Server » Server Administration » Retreive data from table
Retreive data from table [message #372783] Fri, 09 March 2001 08:15 Go to next message
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 messageGo to next message
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
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 !!!
Previous Topic: Constraint applies, but doesn't work
Next Topic: ORA-04043: object RMS.TrackSys does not exist
Goto Forum:
  


Current Time: Sat Jun 29 13:42:22 CDT 2024