简体   繁体   中英

Magento: Populate column data from another table

I'm using Magento Community 1.6.2.

Due to a bad import, my media positions are all screwed up.

To repair I would like to export catalog_product_entity_media_gallery_value and edit the position field. Unfortunately catalog_product_entity_media_gallery_value shows only value_id as an identifier to which product/image is associated.

catalog_product_entity_media_gallery (on the other hand) contains the field value , which is the image path. It also contains the field value_id.

To prep I added the value column to catalog_product_entity_media_gallery_value

Now to my problem:

I would like to join the new value field I created in catalog_product_entity_media_gallery_value with the info from catalog_product_entity_media_gallery using the value_id to associate the right value with its corresponding value_id .

Help....

You mean join the two tables together on value_id ?

SELECT * FROM `catalog_product_entity_media_gallery_value` v
INNER JOIN `catalog_product_entity_media_gallery` g
ON g.value_id = v.value_id

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM