Guest User

Untitled

a guest
Aug 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. Mysql if statement if one colum isn't empty, compare two others
  2. SELECT c.* FROM cca_coupons c
  3. JOIN cca_owners o ON o.id = c.owner_id
  4. WHERE o.id='1'
  5. AND IF c.max_redemptions != '0' THEN c.amount_generated >= c.max_redemptions
  6.  
  7. SELECT c.*
  8. FROM cca_coupons c
  9. JOIN cca_owners o ON o.id=c.owner_id
  10. WHERE c.amount_generated >= c.max_redemptions
  11. AND c.max_redemptions <> '0'
Add Comment
Please, Sign In to add comment