我有以下 SELECT 语句。

SELECT     AETID, DSRID, FYEID, BASICRATE, EURORATE,
  COMID, BRAID, CURID, CURIDCONV, ENTRYDATE, EVNUMBER,
  ORIGIN, IEEID, RELDOCNUM, GJOID, JOURNALNUM,
  JUSTIFICATION, KEPYOAMOUNT, KEPYONUM, STATUS,
  UPDSTATUS, TOTALCB, IDLINKED, CREUSERID, CREUSERDATE,
  UPDUSERID, UPDUSERDATE, ACEIDCROSSENTRY, ACEIDCROSSEDENTRY,
  ISCROSS, ISCROSSED, ACEIDCANCEL, ACEIDPRIMARY, CCEID
FROM         EliteUser.ACE
WHERE     (JOURNALNUM > 1193)
  AND (JOURNALNUM < 2387)

我想要做的是更新特定行,以便 journalnum = 1194 更新为 1,journalnum = 1195 更新为 2 等

最佳答案

哪一列是要输入的新值?假设您要更新 JournalNum 列,使其从 1 开始:

UPDATE
    EliteUser.ACE
SET
    JournalNum = JournalNum - 1193
WHERE
    JournalNum > 1193
AND JournalNum < 2387

关于sql - 更新 sql 表中的特定行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14438752/

10-11 01:27