catalog_product_entity
стол

catalog_product_relation
стол

catalog_product_entity_varchar
таблица

Я хочу экспортировать sku и url из приведенных выше таблиц:
sku
в таблице catalog_product_entity
. url
в таблице catalog_product_relation
.
Я попытался объединить эти три таблицы и выбрать значения url, если таблицы catalog_product_entity entity_id совпадает со столбцом child_id
в catalog_product_relation
, а затем использовать parent_id в выражении where, в других случаях использовать entity_id;
select cpe.sku
, value
from catalog_product_entity as cpe
left join
catalog_product_entity_varchar as cpev
on cpe.entity_id = cpev.entity_id
where cpev.attribute_id = 119 and
type_id = "simple" and
cpev.store_id=0 and
cpev.entity_id =
(
select parent_id
from catalog_product_relation
where child_id = cpe.entity_id
)
Вышеупомянутый запрос не является правильным запросом, который я загрузил здесь для понимания
Редактировать:
catalog_product_entity_varchar заголовок таблиц
