Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- delete from product_image
- where product_id in (
- SELECT p.product_id
- FROM `product` p
- where
- (
- (
- (select count(distinct pi.product_image_id) from product_image pi where p.product_id=pi.product_id)< (select count(*) from photo_templates) AND
- (coalesce((select text from product_attribute pa WHERE pa.product_id=p.product_id and attribute_id=47),'')<>'да')
- )
- OR
- (
- (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
- (coalesce((select text from product_attribute pa WHERE pa.product_id=p.product_id and attribute_id=47),'')='да')
- )
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement