1
我有數據庫,在一個表中我需要改變列的值,由於混合另一位開發者我有名爲credits
的表格和名爲credit_type
的列。mySQL - 如何切換列值 - '短'到'長'和'長'爲'短'
credit_type
有2個值long
和short
。
如何將long
的所有值替換爲short
以及所有值爲short
的值的值爲long
?
我有數據庫,在一個表中我需要改變列的值,由於混合另一位開發者我有名爲credits
的表格和名爲credit_type
的列。mySQL - 如何切換列值 - '短'到'長'和'長'爲'短'
credit_type
有2個值long
和short
。
如何將long
的所有值替換爲short
以及所有值爲short
的值的值爲long
?
update credits set credit_type = 'interim' where credit_type = 'long';
update credits set credit_type = 'long' where credit_type = 'short';
update credits set credit_type = 'short' where credit_type = 'interim';
將它全部包裝在交易中以獲得完全可靠性。