title: Mysql usage "AS"
body: <p>I am a web developer, I have faced on this problem...
  I am developing statistic web app part using php and mysql.</p>
  <pre><code>SELECT
    IF (cat1 = &quot;S4&quot;, 1, 0) AS ncat1,
    IF (cat2 = &quot;S4&quot;, 1, 0) AS ncat2,
    IF (cat3 = &quot;S4&quot;, 1, 0) AS ncat3,
    IF (cat4 = &quot;S4&quot;, 1, 0) AS ncat4,
    (ncat1 + ncat2 + ncat3 + ncat4) AS ntotal
  FROM
    users
  </code></pre>
  <p>I want to get ntotal like this format. but it does not work, unknown column ncat1
  so, I think  fullstack developers can help me easier and quickly
  Help me please....
  Thank you...</p>