Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
Select E.KeyBatchClass,
(Case When E.InternalTest='False' Then (Select BC.ClassName from BachClasses BC where B.Key_Batch=BC.Key_Batch)
When E.InternalTest='True' Then (Select BC.ClassName from BachClasses BC where B.Key_Batch=7) --My this line returns more than 1 rows and i need the same, result. i.e want multiple rows When E.InteralTest=True
End) as Batch_Class
from Exam E,Batch B
where E.keyBatch=B.key_Batch
and E.KeyExam=3
and E.keyBatch=7



Error Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
Posted
Updated 10-Nov-14 2:49am
v2

1 solution

Check this

SQL
Select 
		E.KeyBatchClass,
        BC.ClassName as Batch_Class
from Exam E
Join Batch B On E.keyBatch=B.key_Batch
JOIN BachClasses On B.Key_Batch=
        (Case When E.InternalTest='False' Then BC.Key_Batch else 7 end)
where 
	E.KeyExam=3 and E.keyBatch=7
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900