title: Mysql HAVING clause with condition if it is possible
body: <p>Hello I would like to know if the following HAVING clause is valid </p>
  
  <pre><code>SELECT
    m.id,
    m.username,
    m.name,
    m.department,
    dp.department as dep,
    dp.id,
    (
      SELECT SEC_TO_TIME( SUM( TIME_TO_SEC( `time` ) ) )
      FROM time_management tm
      WHERE 
        tm.user = m.id
        AND MONTH(`date`) = MONTH(CURRENT_DATE())
        AND YEAR(`date`)= YEAR(CURRENT_DATE())
    ) as time
  FROM
    members m 
    LEFT JOIN department dp ON m.department = dp.id   
  WHERE m.department = $departmentvar
  HAVING (($key - time) &gt; 34)
  </code></pre>
  
  <p>in this case <code>$key = 100</code> </p>
  
  <pre><code>time = 5:00:00
  </code></pre>
  
  <p>The idea is to select only results which satisfies the condition that their time is not enough , for example </p>
  
  <p>display results which have <code>time = 5:00:00</code> because (100-5) = 95 > 34 
  but does not display results which have <code>time = 95:00:00</code> because (100-95) = 5 > 34
  for example ?</p>