1
我將一些數據導入到mysql數據庫並嘗試清理它。使用2個字段名(父類,子類)之間的匹配更新MySQL表
| ID |類別名稱|父母名稱| parent_id
1 Baseball (this is a parent)
2 Ball | Baseball | null
3 Bat | Baseball | null
4 Glove | Baseball | null
5 Basketball (this is a parent)
6 Basket | Basketball | null
7 Net | Basketball | null
我該如何做一個UPDATE語句,以便我可以更新每個子類別的parent_id以擁有父ID?所以不是
2球|棒球| null
我喜歡有
2球|棒球| 1
輝煌!謝謝!!!! – 2009-10-04 18:59:47