0
我有一個表,看起來像下面的圖片:設置2行的值相同ROW1值,其列相同
在這裏,我有顯着的兩排。有兩個不同的元鍵,一個是_regular_price,另一個是_price。
現在我想更新meta_value的_price meta_key,並設置價格爲_regular_price。
那麼,我應該寫什麼查詢?
我有一個表,看起來像下面的圖片:設置2行的值相同ROW1值,其列相同
在這裏,我有顯着的兩排。有兩個不同的元鍵,一個是_regular_price,另一個是_price。
現在我想更新meta_value的_price meta_key,並設置價格爲_regular_price。
那麼,我應該寫什麼查詢?
您可以使用自聯接:
update yourtable t1
join yourtable t2
on t1.post_id = t2.post_id and t2.meta_key = '_regular_price'
set t1.meta_value = t2.meta_value
where t1.meta_key = '_price'
這樣來做:
update table1 set meta_key= '_regular_price' where meta_id = 2364389
希望它幫助。