Инвент Пром
Ученик
(132),
на голосовании
5 лет назад
При выполнении запроса, в результате только одна строка, а должно быть больше, укажите на ошибку
SELECT posts.ID, posts.post_title, posts.post_content, posts.post_name, posts.post_status, articul.meta_value As '_sku', atributs.meta_value As '_product_attributes', image_gallery.meta_value As '_product_image_gallery', thumbnail_id.meta_value As '_thumbnail_id', ostatok.meta_value As '_stock', price.meta_value As '_price', GROUP_CONCAT(inpr_term_taxonomy.term_id SEPARATOR ';') As term_id_brand, GROUP_CONCAT(inpr_term_taxonomy_group.term_id SEPARATOR ';') As term_id_group
FROM inpr_posts as posts LEFT JOIN inpr_postmeta As articul ON (posts.id = articul.post_id) LEFT JOIN inpr_postmeta As atributs ON (articul.post_id = atributs.post_id) LEFT JOIN inpr_postmeta As image_gallery ON (atributs.post_id = image_gallery.post_id) LEFT JOIN inpr_postmeta As thumbnail_id ON (image_gallery.post_id = thumbnail_id.post_id) LEFT JOIN inpr_postmeta As ostatok ON (image_gallery.post_id = ostatok.post_id) LEFT JOIN inpr_postmeta As price ON (ostatok.post_id = price.post_id)
LEFT JOIN inpr_term_relationships As inpr_term_relationships ON (inpr_term_relationships.object_id = price.post_id) LEFT JOIN inpr_term_taxonomy As inpr_term_taxonomy ON (inpr_term_taxonomy.term_taxonomy_id = inpr_term_relationships.term_taxonomy_id)
LEFT JOIN inpr_term_relationships As inpr_term_relationships_group ON (inpr_term_relationships.object_id = price.post_id) LEFT JOIN inpr_term_taxonomy As inpr_term_taxonomy_group ON (inpr_term_taxonomy_group.term_taxonomy_id = inpr_term_relationships_group.term_taxonomy_id)
where posts.post_type = 'product' and articul.meta_key = '_sku' and atributs.meta_key = '_product_attributes' and image_gallery.meta_key = '_product_image_gallery' and thumbnail_id.meta_key = '_thumbnail_id' and ostatok.meta_key = '_stock' and price.meta_key = '_price' and inpr_term_taxonomy.taxonomy = 'pwb-brand' and inpr_term_taxonomy_group.taxonomy = 'product_cat'
SELECT
posts.ID,
posts.post_title,
posts.post_content,
posts.post_name,
posts.post_status,
articul.meta_value As '_sku',
atributs.meta_value As '_product_attributes',
image_gallery.meta_value As '_product_image_gallery',
thumbnail_id.meta_value As '_thumbnail_id',
ostatok.meta_value As '_stock',
price.meta_value As '_price',
GROUP_CONCAT(inpr_term_taxonomy.term_id SEPARATOR ';') As term_id_brand,
GROUP_CONCAT(inpr_term_taxonomy_group.term_id SEPARATOR ';') As term_id_group
FROM
inpr_posts as posts
LEFT JOIN inpr_postmeta As articul
ON (posts.id = articul.post_id)
LEFT JOIN inpr_postmeta As atributs
ON (articul.post_id = atributs.post_id)
LEFT JOIN inpr_postmeta As image_gallery
ON (atributs.post_id = image_gallery.post_id)
LEFT JOIN inpr_postmeta As thumbnail_id
ON (image_gallery.post_id = thumbnail_id.post_id)
LEFT JOIN inpr_postmeta As ostatok
ON (image_gallery.post_id = ostatok.post_id)
LEFT JOIN inpr_postmeta As price
ON (ostatok.post_id = price.post_id)
LEFT JOIN inpr_term_relationships As inpr_term_relationships
ON (inpr_term_relationships.object_id = price.post_id)
LEFT JOIN inpr_term_taxonomy As inpr_term_taxonomy
ON (inpr_term_taxonomy.term_taxonomy_id = inpr_term_relationships.term_taxonomy_id)
LEFT JOIN inpr_term_relationships As inpr_term_relationships_group
ON (inpr_term_relationships.object_id = price.post_id)
LEFT JOIN inpr_term_taxonomy As inpr_term_taxonomy_group
ON (inpr_term_taxonomy_group.term_taxonomy_id = inpr_term_relationships_group.term_taxonomy_id)
where
posts.post_type = 'product'
and articul.meta_key = '_sku'
and atributs.meta_key = '_product_attributes'
and image_gallery.meta_key = '_product_image_gallery'
and thumbnail_id.meta_key = '_thumbnail_id'
and ostatok.meta_key = '_stock'
and price.meta_key = '_price'
and inpr_term_taxonomy.taxonomy = 'pwb-brand'
and inpr_term_taxonomy_group.taxonomy = 'product_cat'