I was looking for a way to do a subquery in a MYSQL query, such as:
SELECT Name, Age, State, Rank, (CASE SELECT Last_Years_Rank FROM 2009 WHERE Name='Name' IF NOT EXISTS THEN 0) AS Last_Year_Rank FROM 2010 WHERE Name='Frank Jenkins'
Basically looking to pull data from a second table if it exists, and 0 if it does not. I have a good understanding of mysql, but combining a subquery w/ CASE statements is throwing me. I'd like it to return 0 if the customer is not in the 2009 database (so that adding the ranks only accounts for 2010).
Thanks in advance for any help.