Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL QUERY

Author  Topic 

vipin_jha123
Starting Member

31 Posts

Posted - 2011-04-08 : 05:27:55
Dear sir ,

please give solution of given query

select gam.cif_id,
gam.foracid,
RCT.ref_desc ON THE BASIS OF GIVEN CONDITION RCT.ref_code = GAC.free_text_4

FROM GAM,RCT TABLE

my query was :-
Select RCT.ref_desc
From TBAADM.RCT
Where RCT.ref_desc In (Select RCT.ref_desc From TBAADM.RCT, TBAADM.GAC
Where RCT.ref_code = GAC.free_text_4)

when i used this query in my main select then it gioves error of
ORA-01427: single-row subquery returns more than one

please provide the correct solution

ms65g
Constraint Violating Yak Guru

497 Posts

Posted - 2011-04-08 : 07:05:00
select G.cif_id, G.foracid, R.ref_desc
FROM GAM G
JOIN RCT R
ON R.ref_code = G.free_text_4;


Select RCT.ref_desc
From TBAADM.RCT
Where RCT.ref_code In (Select free_text_4
From TBAADM.GAC)

______________________
Go to Top of Page

vipin_jha123
Starting Member

31 Posts

Posted - 2011-04-08 : 07:27:52
THANKS FOR KIND REPLY
But i want that query in inner one

Select gam.foracid, (Select RCT.ref_desc From TBAADM.RCT
Where RCT.ref_code In (Select TBAADM.GAC.FREE_TEXT_4 From TBAADM.GAC)) ti
From TBAADM.GAM

but when i am executing this one it shows the same error

plz do the needfull
Go to Top of Page

ms65g
Constraint Violating Yak Guru

497 Posts

Posted - 2011-04-08 : 07:45:03
Try these:
select G.cif_id, G.foracid, R.ref_desc 
FROM GAM G
LEFT JOIN RCT R
ON R.ref_code = G.free_text_4
JOIN GAC
ON R.rec_code = GAC.free_text_4



Select gam.foracid,
(Select ref_desc From TBAADM.RCT R
Where ref_code In (Select TBAADM.GAC.FREE_TEXT_4 From TBAADM.GAC)
and R.ref_code = G.ref_code) ti
From TBAADM.GAM G


______________________
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-04-08 : 07:53:47
btw. this isn't an ORACLE forum


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -