title: Executing sub query with case
body: <p>I have to run a sub query with case statement inside of sub query. When I run the sub query independently it works, but as a sub query it gives following error :</p>
  
  <blockquote>
    <p>Subquery returned more than 1 value. This is not permitted when the
    subquery follows =, !=, &lt;, &lt;= , >, >= or when the subquery is used as
    an expression.</p>
  </blockquote>
  
  <p>This is my query :</p>
  
  <pre><code>select categoryid, categoryname, (select (case when c.ParentCategoryId is NULL then null else c.CategoryName end) as Parent_Category_Name from Categories c) from Categories
  </code></pre>
  
  <p>My categories table has 3 columns : CategoryId, CategoryName, ParentCategoryId</p>
  
  <p>I am not able to figure out how can I fetch required result.</p>