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 2012 Forums
 Transact-SQL (2012)
 Subquery returned more than 1 value

Author  Topic 

rjhe22
Constraint Violating Yak Guru

283 Posts

Posted - 2014-03-05 : 07:47:14
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
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2014-03-05 : 08:05:34
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

283 Posts

Posted - 2014-03-05 : 08:55:01
thanks for reply will look into that
Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2014-03-05 : 09:45:59
you're welcome!

Cheers
MIK
Go to Top of Page
   

- Advertisement -