Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.02 KB | None | 0 0
  1. SELECT
  2.     p.date_added
  3.     , p.products_id
  4.     , pa.products_attributes_id
  5.     , IFNULL(pal.products_attributes_parent_id, pa.products_attributes_id) AS products_attributes_parent_id
  6.     , 0 AS incomes_attributes_id
  7.     , -1 AS shipment_object_type_id
  8.     , ptc.categories_id AS shipment_object_id
  9.     , ptc.categories_id
  10.     , 0 AS incomes_id
  11.     , pp.products_purchase_price AS purchase_price
  12.     , pp.products_VAT AS vat_rate
  13.     , p.brandswelove_id
  14.     , 1 AS shipment_products_type_id
  15.     , p.date_added  AS last_date_update_p
  16.     , pp.last_date_update AS last_date_update_pp
  17.     , c.last_date_update AS last_date_update_c
  18. FROM products AS p
  19.     JOIN products_attributes AS pa ON pa.products_id = p.products_id
  20.     LEFT JOIN products_attributes_legacy AS pal ON pal.products_attributes_id = pa.products_attributes_id
  21.     JOIN products_to_categories AS ptc ON ptc.products_id = p.products_id
  22.     JOIN products_prices AS pp ON pp.products_attributes_id = pa.products_attributes_id
  23.     JOIN categories AS c ON ptc.categories_id = c.categories_id
  24. WHERE p.entities_types_id = 46
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement