Subquery used in Where returns more than one row

2 posts / 0 new
Last post
Anonymous
Subquery used in Where returns more than one row

 

 

 

 

What will happen if the subquery in the following SQL returns more than one value?

SELECT Name, Marks

FROM Student

WHERE Class = (SELECT Class FROM School  WHERE Class  ='II%')

 

1.      The outer query will run with the first value fetched from sub-query

2.      It will not run and give no error

3.      It will give error

4.      The outer query will run with last value fetched from sub-query

"; ; ; ;
Offline
Joined: 07/07/2011 - 19:59
Subquery

you will get an error, what i think you are trying to achieve is the following:

SELECT Name, Marks

FROM Student

WHERE Class IN (SELECT Class FROM School WHERE Class ='II%') ;

Log in or register to post comments
Sponsored Listing