congky

Untitled

Oct 4th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT A.product_id, A.product_code, A.product_name, A.create_datetime AS create_datetime_product, A.update_datetime AS update_datetime_product,
  2.     A.active_datetime AS active_datetime_product, A.non_active_datetime AS non_active_datetime_product, A.active AS active_product,
  3.    
  4.     COALESCE(B.style_product, '') AS style, 'http://sdp-data.storage.googleapis.com/product_images/'||COALESCE(B.style_product, '')||'-1.jpg' AS style_image, COALESCE(B.size, '') size, COALESCE(B.color, '') color,
  5.     COALESCE(B.flg_buy_konsinyasi, '') AS flag_consignment, COALESCE(B.create_datetime,'') AS create_datetime_product_custom, COALESCE(B.update_datetime, '') AS update_datetime_product_custom,
  6.     COALESCE(B.active_datetime, '') AS active_datetime_product_custom, COALESCE(B.non_active_datetime, '') AS non_active_datetime_product_custom, COALESCE(B.active, '') AS active_product_custom,
  7.    
  8.     COALESCE(C.product_custom_field_id, -99) AS product_custom_field_id_gender, COALESCE(C.value, '') AS gender, COALESCE(C.create_datetime, '') AS create_datetime_product_custom_field_gender,
  9.     COALESCE(C.update_datetime, '') AS update_datetime_product_custom_field_gender, COALESCE(C.active_datetime, '') AS active_datetime_product_custom_field_gender,
  10.     COALESCE(C.non_active_datetime, '') AS non_active_datetime_product_custom_field_gender, COALESCE(C.active, '') AS active_product_custom_field_gender,
  11.    
  12.     COALESCE(D.product_custom_field_id, -99) AS product_custom_field_id_type, COALESCE(D.value, '') AS jenis, COALESCE(D.create_datetime, '') AS create_datetime_product_custom_field_type,
  13.     COALESCE(D.update_datetime, '') AS update_datetime_product_custom_field_type, COALESCE(D.active_datetime, '') AS active_datetime_product_custom_field_type,
  14.     COALESCE(D.non_active_datetime, '') AS non_active_datetime_product_custom_field_type, COALESCE(D.active, '') AS active_product_custom_field_type,
  15.    
  16.     A.ctgr_product_id, E.ctgr_product_code AS category_code, E.ctgr_product_name AS category_name, E.create_datetime AS create_datetime_category,
  17.     E.update_datetime AS update_datetime_category, E.active_datetime AS active_datetime_category,
  18.     E.non_active_datetime AS non_active_datetime_category, E.active AS active_category,
  19.    
  20.     A.sub_ctgr_product_id, F.sub_ctgr_product_code AS sub_category_code, F.sub_ctgr_product_name AS sub_category_name, F.create_datetime AS create_datetime_sub_category,
  21.     F.update_datetime AS update_datetime_sub_category, F.active_datetime AS active_datetime_sub_category,
  22.     F.non_active_datetime AS non_active_datetime_sub_category, F.active AS active_sub_category,
  23.    
  24.     A.brand_id, G.brand_code, G.brand_name, G.create_datetime AS create_datetime_brand,
  25.     G.update_datetime AS update_datetime_brand, G.active_datetime AS active_datetime_brand,
  26.     G.non_active_datetime AS non_active_datetime_brand, G.active AS active_brand,
  27.  
  28.     COALESCE(H.supplier_id, -99) AS supplier_id, COALESCE(H.supplier_product_code, '') AS supplier_product_code, COALESCE(H.create_datetime, '') AS create_datetime_supplier_info,
  29.     COALESCE(H.update_datetime, '') AS update_datetime_supplier_info, COALESCE(H.active_datetime, '') AS active_datetime_supplier_info,
  30.     COALESCE(H.non_active_datetime, '') AS non_active_datetime_supplier_info, COALESCE(H.active, '') AS active_supplier_info,
  31.  
  32.     COALESCE(I.partner_code, '') AS supplier_code, COALESCE(I.partner_name, '') AS supplier_name, COALESCE(I.create_datetime, '') AS create_datetime_supplier,
  33.     COALESCE(I.update_datetime, '') AS update_datetime_supplier, COALESCE(I.active_datetime, '') AS active_datetime_supplier,
  34.     COALESCE(I.non_active_datetime, '') AS non_active_datetime_supplier, COALESCE(I.active, '') AS active_supplier,
  35.  
  36.     COALESCE(J.weight, 0.0) AS weight, COALESCE(J.dimension_length, 0.0) AS length, COALESCE(J.dimension_width, 0.0) AS width, COALESCE(J.dimension_height, 0.0) AS height, COALESCE(J.create_datetime, '') AS create_datetime_dimension,
  37.     COALESCE(J.update_datetime, '') AS update_datetime_dimension, COALESCE(J.active_datetime, '') AS active_datetime_dimension,
  38.     COALESCE(J.non_active_datetime, '') AS non_active_datetime_dimension, COALESCE(J.active, '') AS active_dimension,
  39.  
  40.     COALESCE(K.product_vat_id, -99) AS product_vat_id, COALESCE(K.percentage, 0.0) AS product_vat, COALESCE(K.create_datetime, '') AS create_datetime_vat,
  41.     COALESCE(K.update_datetime, '') AS update_datetime_vat, COALESCE(K.active_datetime, '') AS active_datetime_vat,
  42.     COALESCE(K.non_active_datetime, '') AS non_active_datetime_vat, COALESCE(K.active, '') AS active_vat
  43.     --SELECT COUNT (1)
  44. FROM m_product A
  45. INNER JOIN m_ctgr_product E ON A.ctgr_product_id = E.ctgr_product_id
  46. INNER JOIN m_sub_ctgr_product F ON A.sub_ctgr_product_id = F.sub_ctgr_product_id
  47. INNER JOIN m_brand G ON A.brand_id = G.brand_id
  48. LEFT JOIN m_product_custom B ON A.product_id = B.product_id
  49. LEFT JOIN m_product_custom_field C ON A.product_id = C.product_id AND A.tenant_id = C.tenant_id AND C.product_attr_code = 'GENDER'
  50. LEFT JOIN m_product_custom_field D ON A.product_id = D.product_id AND A.tenant_id = D.tenant_id AND D.product_attr_code = 'TYPE'
  51. LEFT JOIN m_product_consignment_supp_info H ON A.product_id = H.product_id
  52. LEFT JOIN m_partner I ON H.supplier_id = I.partner_id
  53. LEFT JOIN m_product_weight_dimension J ON A.product_id = J.product_id
  54. LEFT JOIN m_product_vat K ON A.product_id = K.product_id
Add Comment
Please, Sign In to add comment