title: Conditional Sql in Daisy chained Query
body: <p>I have one master table with all the IDs to each child table. The SQL statement looks like this...</p>
  
  <pre><code>SELECT   Class.Descript
         , Regulation.Descript AS Reg
         , Compgroup.Descript AS Grouping
         , Category.Descript AS Cat
         , Exempt.Descript AS Exempt
         , Reason.Descript AS Reasons
         , COALESCE(ComponentRuleSet.NormalType, ComponentRuleSet.Supertype, '') AS Type
  FROM     ComponentRuleSet 
  LEFT OUTER JOIN Reason 
     ON ComponentRuleSet.ComponentCategoryID = Reason.ComponentCategoryID 
  LEFT OUTER JOIN Class 
     ON ComponentRuleSet.ComponentClassID = Class.ComponentClassID
  LEFT OUTER JOIN Regulation
     ON ComponentRuleSet.RegulationID = Regulation.RegulationID 
  LEFT OUTER JOIN Compgroup
     ON ComponentRuleSet.ComplianceGroupID = Compgroup.ComplianceGroupID
  LEFT OUTER JOIN Category 
     ON ComponentRuleSet.ComponentCategoryID = Category.ComponentCategoryId
  LEFT OUTER JOIN Exempt 
     ON ComponentRuleSet.ExemptID = Exempt.ComponentExemptionID
  WHERE (ComponentRuleSet.ComponentID = 38048)
  </code></pre>
  
  <p>The problem is that there are two fields in the <strong>ComponentRuleSet</strong> table called <strong>NormalType</strong> and <strong>Supertype</strong>. If either of those fields have a value, I need to display it in a column called <strong>Type</strong>. Yet, if neither have a value I need to display a Blank value in the <strong>Type</strong> column. 
  Any ideas?</p>
  
  <p>---EDIT</p>
  
  <p>Is my placement of COALESCE correct in the edited query? It is still returning errors.</p>
  
  <p>--UPDATE</p>
  
  <p>IMPORTANT: The type of both fields are boolean, I need to return the column name of the column that holds a TRUE value, and place that value in the TYPE column. </p>