作者:冰_若真人_755_171 | 来源:互联网 | 2023-02-09 19:22
Ihave2tablesxcart_productswhichhasproductid,meta_descriptionandmanyotherfields.The2n
I have 2 tables xcart_products which has productid , meta_description
and many other fields . The 2nd table is xcart_extra_field_values which has ( productid fieldid and value
)
我有2个表xcart_products,它们有productid,meta_description和许多其他字段。第二个表是xcart_extra_field_values,它有(productid fieldid和value)
I need to copy the value of fieldID = 1
of xcart_extra_field_values
我需要复制xcart_extra_field_values的fieldID = 1的值
into
成
the meta_description
column of the xcart_products
table where the Productid
are same.
xcart_products表的meta_description列,其中Productid是相同的。
UPDATE `xcart_products` SET meta_description = ( SELECT value FROM
xcart_extra_field_values WHERE fieldid = 1 AND
xcart_extra_field_values.productid = xcart_products.productid )
WHERE
xcart_extra_field_values.productid = xcart_products.productid ;
I wrote the above SQL but i am getting an error
我写了上面的SQL,但我收到了一个错误
#1054 - Unknown column 'xcart_extra_field_values.productid' in 'where clause'
3 个解决方案