[MySQL] Add condition to Virutal Fields

/ Published in: MySQL
Save to your folder(s)

By using HAVING 'virtual_field' CONDITION we can add conditions to virtual fields that created at SELECT

Copy this code and paste it in your HTML
  1. id,
  2. user_id,
  3. defeated_login_boss_id,
  4. number_of_times,
  5. SUM(number_of_times) AS total
  6. tb_user_login_boss_collections
  7. WHERE defeated_login_boss_id = 2
  8. GROUP BY user_id
  9. HAVING total > 9

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.