Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. delete from product_image
  2. where product_id in (
  3. SELECT p.product_id
  4. FROM `product` p
  5. where
  6. (
  7. (
  8. (select count(distinct pi.product_image_id) from product_image pi where p.product_id=pi.product_id)< (select count(*) from photo_templates) AND
  9. (coalesce((select text from product_attribute pa WHERE pa.product_id=p.product_id and attribute_id=47),'')<>'да')
  10. )
  11. OR
  12. (
  13. (select count(distinct pi.product_image_id) from product_image pi where p.product_id=pi.product_id)< (select count(*) from photo_templates) * 3 AND
  14. (coalesce((select text from product_attribute pa WHERE pa.product_id=p.product_id and attribute_id=47),'')='да')
  15. )
  16. )
  17. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement