title: Select values from one table, where another = value?
body: <p>I am trying to run a SQL query (SQL Server) that will look up a list of names from a subquery.</p>
  
  <p>I have this but I get a "subquery returned more than 1" error:</p>
  
  <pre><code>SELECT FirstName + ' ' + LastName AS Name
  FROM Members
  WHERE     
     (MemberGUID = (SELECT ClassDetails.Leader
                    FROM Members AS Members_1 
                    INNER JOIN MemberDetails ON Members_1.MemberGUID = MemberDetails.Member 
                    INNER JOIN ClassDetails ON ClassDetails.Class = Members_1.CurrentClass
                    WHERE      
                        (MemberDetails.JoiningDate &gt;= '02/03/2012') 
                        AND (Members_1.FirstName = '*') 
                        OR (MemberDetails.JoiningDate &gt;= '02/03/2012') 
                        AND (Members_1.LastName = '*') 
                        OR (MemberDetails.JoiningDate &gt;= '02/03/2012') 
                        AND (MemberDetails.Email IS NULL) 
                        AND (MemberDetails.MobilePhone IS NULL) 
                        AND (MemberDetails.WorkPhone IS NULL) 
                        AND (MemberDetails.HomePhone IS NULL) 
                        AND (Members_1.CurrentClass &lt;&gt; 339) 
                        AND (Members_1.CurrentClass &lt;&gt; 696) 
                        AND (Members_1.CurrentClass &lt;&gt; 0)))
  </code></pre>
  
  <p>I need this to return the values <code>FirstName</code> and <code>LastName</code> for every value returned in the subquery. (The subquery returns a list of GUIDs which should be fed into the <code>WHERE MemberGUID</code> statement)</p>
  
  <p>How can this be done?</p>