我有一個列如book
,startyear
,endyear
和author
列表。更新在同一表中的兩個條件的表
我需要startyear
和endyear
列同時根據下列條件更新,
STARTYEAR = ENDYEAR where STARTYEAR=0 and ENDYEAR != 0
also
ENDYEAR = STARTYEAR where ENDYEAR =0 and STARTYEAR != 0
這是可能的
UPDATE Table SET STARTYEAR = ENDYEAR WHERE STARTYEAR=0 AND ENDYEAR<>0;
UPDATE Table SET ENDYEAR = STARTYEAR WHERE ENDYEAR =0 AND STARTYEAR<>0;
我怎麼能在一個查詢寫這2個查詢?
你可以只讓他們的機器人= 0,因爲這是希望的結果當任爲0 – Techmonk
@Techmonk不,你應該重新閱讀的問題,我們的目標是不設置這些值0 –
你是對的。 ..這是相反的方式! – Techmonk