SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Subquery returned more than 1 value
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rjhe22
Constraint Violating Yak Guru

254 Posts

Posted - 03/05/2014 :  07:47:14  Show Profile  Reply with Quote
hi im trying to get the following code working but keeps giving me an error

here is code
SELECT  generic.SyntheticRiskAndReward.FundName
FROM generic.SyntheticRiskAndReward 
INNER JOIN
generic.MasterInventory ON 
generic.SyntheticRiskAndReward.FK_MasterInventory = 
(SELECT  (generic.MasterInventory.PK_MasterInventory)AS MasterInventoryList
FROM    generic.Client INNER JOIN
        generic.MasterInventory ON 
      generic.Client.PK_Client = generic.MasterInventory.FK_Client 
             WHERE generic.Client.ClientName = 'RBC IS Accent')


here is error

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

MIK_2008
Flowing Fount of Yak Knowledge

Pakistan
1052 Posts

Posted - 03/05/2014 :  08:05:34  Show Profile  Reply with Quote
well your subquery is returning more than one record and the operator you used is equality.... so its obvious. Either make the inner query such that it only (and always return) one record or change the equality "generic.SyntheticRiskAndReward.FK_MasterInventory =" operator to "generic.SyntheticRiskAndReward.FK_MasterInventory IN" in order to avoid this error. :)


Cheers
MIK
Go to Top of Page

rjhe22
Constraint Violating Yak Guru

254 Posts

Posted - 03/05/2014 :  08:55:01  Show Profile  Reply with Quote
thanks for reply will look into that
Go to Top of Page

MIK_2008
Flowing Fount of Yak Knowledge

Pakistan
1052 Posts

Posted - 03/05/2014 :  09:45:59  Show Profile  Reply with Quote
you're welcome!

Cheers
MIK
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000