Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select DISTINCT lower(CONCAT(
- ifnull(category,''), ' ; ',
- ifnull(publisher,''), ' ; ',
- ifnull(manufacturer,'')
- )) as data_index,
- sku, name, author, category, publisher, manufacturer
- from (
- (select pe.sku, name.value as name, fs.authors as author, fs.category, fs.publisherName as publisher, ca_manufacturer_ov.value as manufacturer
- from fhs_catalog_product_entity pe
- JOIN fhs_catalog_product_entity_varchar name ON pe.entity_id = name.entity_id AND name.attribute_id = 71
- JOIN fhs_catalog_product_entity_decimal price ON pe.entity_id = price.entity_id AND price.attribute_id = 75
- LEFT JOIN fhs_catalog_product_entity_int ca_manufacturer ON ca_manufacturer.entity_id = pe.entity_id AND ca_manufacturer.attribute_id = 81
- LEFT JOIN fhs_eav_attribute_option_value ca_manufacturer_ov ON ca_manufacturer_ov.option_id = ca_manufacturer.value
- left join fahasa_stock fs on fs.sku = pe.sku
- where price.value > 0)
- union
- (
- select mabh as sku, tenhh as name, TACGIA as auhor, TENNGANH as category, tenNXB as publisher, tenNCC as manufacturer
- from fahasa_ebiz_stock_info ebiz
- where length(mabh) > 5)
- union
- (
- select sku, name, authors as author, category, publisherName as publisher, null as manufacturer
- from fahasa_stock fs
- where length(sku) > 5)
- ) a
- group by sku;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement