title: mysql select case multiple columns as
body: <p>I want to set multiple fields with something like this, how can I make it work?</p>
  
  <pre><code>Select TableId,
      CASE
          WHEN StartTime &gt; Appt THEN
              Field AS Field_1
              FieldId AS FieldId_1
          WHEN StartTime BETWEEN Appt AND DATE_ADD(Appt, INTERVAL 1 MONTH) THEN
              Field AS Field_2
              FieldId AS FieldId_2
      END
  FROM TableA;
  </code></pre>
  
  <p>It doesn't work, the syntax is wrong near AS Field_1.</p>