Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT "product_id",
- "stock_product"."id",
- "stock_id",
- "price",
- "cu_price",
- "amount",
- "multiplicity",
- "stock_product"."date_modified",
- "_cross_type",
- "manufacturer"."name"
- FROM (SELECT "stock_product".*,
- ceil(price * (1 + (COALESCE(CASE
- WHEN (SELECT "surcharge_percent"
- FROM "customer_group_surcharge_range"
- WHERE (("customer_group_surcharge_range"."stock_id" = stock_product.stock_id) OR
- ("customer_group_surcharge_range"."stock_id" IS NULL))
- AND ("customer_group_surcharge_range"."customer_group_id" = 19)
- AND (CEIL("stock_product".price) BETWEEN min_price AND max_price)
- ORDER BY "stock_id", "min_price"
- LIMIT 1) < -99 THEN 1
- ELSE (SELECT "surcharge_percent"
- FROM "customer_group_surcharge_range"
- WHERE (("customer_group_surcharge_range"."stock_id" = stock_product.stock_id) OR
- ("customer_group_surcharge_range"."stock_id" IS NULL))
- AND ("customer_group_surcharge_range"."customer_group_id" = 19)
- AND (CEIL("stock_product".price) BETWEEN min_price AND max_price)
- ORDER BY "stock_id", "min_price"
- LIMIT 1) END, 21) / 100.0))) AS "cu_price",
- CASE
- WHEN product.id = 427082 THEN 0
- WHEN manufacturer_id = 2380 THEN 0
- ELSE cross_type + 1
- END AS "_cross_type"
- FROM (
- SELECT *
- FROM "stock_product"
- WHERE ("stock_product"."product_id" IN
- (208748, 427082, 735727, 796608, 797704, 844633, 1172790, 1183102, 1283524, 1382304, 1529888,
- 1704050, 1741991, 1870037, 2081793, 2495048, 2504768, 2818736, 2842036, 2943893, 2966302, 3061825,
- 4099834, 4190072, 4215283, 4866023, 5064121, 5070751, 6157929, 6370129, 6624134, 6641479))
- AND ("amount" > 0)
- AND (EXISTS(SELECT 1 FROM "stock" WHERE ("act" = 1) AND ("id" = "stock_product".stock_id)))
- AND (NOT EXISTS(SELECT 1
- FROM "disabled_stock_to_customer_group"
- WHERE ("customer_group_id" = 19)
- AND ("stock_id" = "stock_product".stock_id)))
- ) "stock_product"
- INNER JOIN "product" ON "stock_product"."product_id" = "product"."id"
- INNER JOIN "crosses" ON "product"."id" = "crosses"."associative") "stock_product"
- LEFT JOIN "product" ON "stock_product"."product_id" = "product"."id"
- LEFT JOIN "manufacturer" ON "product"."manufacturer_id" = "manufacturer"."id"
- WHERE cu_price between '739' and '2122'
- GROUP BY "product_id", "stock_product"."id", "stock_id", "price", "cu_price", "amount", "multiplicity",
- "stock_product"."date_modified", "_cross_type", "manufacturer"."name"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement