Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.44 KB | None | 0 0
  1. select
  2. o.increment_id as orderId,
  3. convert_tz(o.created_at, '+0:00', '+7:00') as created_at,
  4. o.customer_email as email,
  5. o.status as status,
  6. CONCAT(sab.street ,' ', sab.city,' ', sab.region ,' ', sab.country_id) AS address,
  7. CONCAT(sab.lastname,' ', sab.firstname) as customerName,
  8. sab.telephone AS phone,
  9. o.pickup_location,
  10. i.name AS productName,
  11. pe.entity_id as productId,
  12. pe.sku AS sku,
  13. thumbnail.value AS thumbnail,
  14. IFNULL(price.value, i.original_price) AS originalPrice,
  15. i.original_price AS price,
  16. GREATEST(i.qty_ordered, IFNULL(i.qty_backordered, 0)) - i.qty_canceled - i.qty_shipped - i.qty_refunded AS qty
  17. from fhs_sales_flat_order o
  18. JOIN fhs_sales_flat_order_item i           ON i.order_id = o.entity_id
  19. LEFT JOIN fhs_catalog_product_entity pe         ON i.product_id = pe.entity_id
  20. LEFT JOIN fhs_catalog_product_entity_varchar thumbnail ON pe.entity_id = thumbnail.entity_id AND thumbnail.attribute_id = 87
  21. LEFT JOIN fhs_catalog_product_entity_varchar publisher ON pe.entity_id = publisher.entity_id AND publisher.attribute_id = 142
  22. LEFT JOIN fhs_catalog_product_entity_decimal price ON pe.entity_id = price.entity_id AND price.attribute_id = 75
  23. JOIN fhs_sales_flat_order_address sab      ON o.billing_address_id = sab.entity_id
  24. where o.increment_id = '100869217'
  25. and o.status = "pending" and o.state = "new"
  26. and o.pickup_location is not null
  27. and (NOT ((i.product_type = 'simple') AND (i.product_options LIKE '%bundle_selection_attributes%')));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement