title: Default field value if a condition satisfies in Azure Stream Analytics SAQL
body: <p>I have a requirement to set value of one field as per value of another field available in the document.</p>
  
  <p>Below is the SAQL which I tried for obtaining the requirement.</p>
  
  <pre><code>WITH INPUT01 AS (
      SELECT
          input.id AS ID,
          ROUND(input.sig,5) AS SIG,
          input.dtcTriggeredDateTime.dateTime.time AS TIME,
          input.Description as DESC
          FROM [inputsignals] as input
      WHERE GetArrayLength(input.abc) =0 AND (input.Description = 'xyz' OR input.Description = 'pqr')
  
  SELECT 
      ID,
      SIG,
      TIME,
      001 AS NUMID 
  INTO [cosmosDB]
  FROM INPUT01
  WHERE DESC = 'abc'
  
  SELECT 
      ID,
      SIG,
      TIME,
      002 AS NUMID 
  INTO [cosmosDB]
  FROM INPUT01
  WHERE DESC = 'pqr'
  </code></pre>
  
  <p>If the DESC is <strong>abc</strong> then <strong>NUMID</strong> should be <strong>001</strong> and if DESC is <strong>pqr</strong> then <strong>NUMID</strong> should be <strong>002</strong>.</p>
  
  <p>Instead of writing the last two select statements separately is there any options to write it in a single SELECT query as something like below?</p>
  
  <pre><code>SELECT 
      ID,
      SIG,
      TIME,
      001 AS NUMID  (If DESC = abc)
      002 AS NUMID  (If DESC = pqr)
  INTO [cosmosDB]
  FROM INPUT01
  </code></pre>