Home » RDBMS Server » Server Utilities » sql query
sql query [message #74553] Wed, 05 January 2005 22:53 Go to next message
gln.sarma
Messages: 11
Registered: April 2004
Location: hyderabad`
Junior Member

I have a to table data with field1, field2, field3.
Query to find all values field1 where field2 and field3 are common

data

field 1 field 2 filed 3
------------------------------------
A F 10
A R 20
A P 70
B F 9
B R 20
B P 70
C F 10
C R 20
C P 70
D F 80
D R 20
E F 80
E R 20

after SQl data should appear as

A F 10
C P 20
R 70
B F 9
P 20
R 70
D F 80
E R 20
Re: sql query [message #74595 is a reply to message #74553] Sun, 16 January 2005 20:12 Go to previous message
anil sinare
Messages: 61
Registered: November 2004
Location: pune
Member

Hi,

Following query may help you to achive desired results.

SELECT
*
FROM
Test
WHERE (field2,field3) IN
(SELECT
field2,
field3
FROM
Test
GROUP BY
field2,field3
HAVING COUNT(Field2) >1);

Thanks and Regards
Anil Sinare
Previous Topic: When can I get rid of Archived redo logs
Next Topic: Error when import database
Goto Forum:
  


Current Time: Wed Dec 25 20:12:09 CST 2024