Skip to content

Latest commit

 

History

History

Subquery

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
Subquery

If you are only returning a single value, you might use that value in a logical statement like WHERE, HAVING, or even SELECT - 
the value could be nested within a CASE statement.
Expert Tip
Note that you should not include an alias when you write a subquery in a conditional statement. 
This is because the subquery is treated as an individual value (or set of values in the IN case) rather than as a table.
Also, notice the query here compared a single value. If we returned an entire column IN would need to be used to perform a logical argument. 
If we are returning an entire table, then we must use an ALIAS for the table, and perform additional logic on the entire table.