Home » SQL & PL/SQL » SQL & PL/SQL » How to select field A having more than one field B with diffrent values ?
How to select field A having more than one field B with diffrent values ? [message #251361] Fri, 13 July 2007 04:36 Go to next message
fortunethiyagu
Messages: 94
Registered: December 2006
Member

Hi,
How to select field A having more than one field B with diffrent values ?

Table name: Sam_tab

Field_a        field_b
--------------------------
 a                   a1
 a                   a2
 a                   a3 
 a                   a4
 a                   a1
 a                   a1
 a                   a4


here i want to select a-a2, a-a3, a-a4 alone.
Logic is to select field_a that has more than one field_b with different value. so the output would be

Field_a           field_b
------------------------------
 a                   a2
 a                   a3 

Please help out me..

Thanx in advance...

[Updated on: Fri, 13 July 2007 05:05]

Report message to a moderator

Re: How to select field A having more than one field B with diffrent values ? [message #251364 is a reply to message #251361] Fri, 13 July 2007 05:47 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
select field_a, field_b from mytable
group by field_a, field_b 
having count(*) = 1
/

Regards
Michel
Re: How to select field A having more than one field B with diffrent values ? [message #251366 is a reply to message #251364] Fri, 13 July 2007 05:59 Go to previous message
fortunethiyagu
Messages: 94
Registered: December 2006
Member

Thanks a lot...it works! rocks!!!![

[Updated on: Fri, 13 July 2007 06:01]

Report message to a moderator

Previous Topic: Bulk collect ..for all..with execute immediate in 8i ???
Next Topic: Inserting / Reading More than 32kb XML File from OS
Goto Forum:
  


Current Time: Mon Dec 02 08:16:13 CST 2024