Home » SQL & PL/SQL » SQL & PL/SQL » Problem in Sql Query...help to find it out..
icon5.gif  Problem in Sql Query...help to find it out.. [message #205491] Sat, 25 November 2006 04:05 Go to next message
Harithareddy11
Messages: 9
Registered: November 2006
Location: BANGALORE
Junior Member
hi all...
below is my table..

SQL> SELECT * FROM HARI_ST;

SNO NAME STATUS
---------- ---------- ----------
1 H 99
2 R 99
1 H 13
3 T 13
4 F 99
2 R 13

6 rows selected.

i should get sno which has both the status's 99 and 13(or sno's more than 1 status)
when i used AND operator..it says no rows selected..

MY output should be as

sno
______
1
2


Regards

Haritha


Re: Problem in Sql Query...help to find it out.. [message #205500 is a reply to message #205491] Sat, 25 November 2006 05:18 Go to previous messageGo to next message
Littlefoot
Messages: 20900
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Something like this?
SELECT SNO FROM hari_st
WHERE status IN (13, 99)
GROUP BY sno
HAVING COUNT(*) = 2;
Re: Problem in Sql Query...help to find it out.. [message #205507 is a reply to message #205500] Sat, 25 November 2006 05:54 Go to previous message
Harithareddy11
Messages: 9
Registered: November 2006
Location: BANGALORE
Junior Member

Thank u very much....
Previous Topic: Output text filename from sql query
Next Topic: Call Function From Dual Table
Goto Forum:
  


Current Time: Wed Dec 07 14:48:53 CST 2016

Total time taken to generate the page: 0.10198 seconds