Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. SELECT DISTINCT p.*, spf.feature_value_id AS type__id, spv3.value AS brand, spv4.value as model
  2. FROM shop_product p
  3. LEFT OUTER JOIN shop_product_features spf ON spf.product_id = p.id AND spf.feature_id = 668
  4. LEFT JOIN shop_product_features spf3 ON spf3.product_id = p.id AND spf3.feature_id = 1
  5. LEFT JOIN shop_feature_values_varchar spv3 ON spv3.feature_id = spf3.feature_id AND spf3.feature_value_id = spv3.id
  6.  
  7. LEFT JOIN shop_product_features spf4 ON spf4.product_id = p.id AND spf4.feature_id = 665
  8. LEFT JOIN shop_feature_values_double spv4 ON spv4.feature_id = spf4.feature_id AND spf4.feature_value_id = spv4.id
  9.  
  10. WHERE p.price>0 AND p.status=1 AND p.name NOT LIKE '%чехол%' AND p.name NOT LIKE '%стекло%' AND p.name NOT LIKE '%apple watch%' AND p.name NOT LIKE '%бампер%' AND p.name NOT LIKE '%накладка%'
  11. AND ( p.count>0 OR p.count IS NULL
  12. -- or p.summary LIKE '%preorder%'
  13. )
  14. GROUP BY p.id
  15. ORDER BY ppt DESC
  16. -- LIMIT 500
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement