Update multiple rows with different values in a single SQL query

前端 未结 6 667
你的背包
你的背包 2020-12-13 09:15

I have a SQLite database with table myTable and columns id, posX, posY. The number of rows changes constantly (might inc

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 09:55

    Something like this might work for you:

    "UPDATE myTable SET ... ;
     UPDATE myTable SET ... ;
     UPDATE myTable SET ... ;
     UPDATE myTable SET ... ;"
    

    If any of the posX or posY values are the same, then they could be combined into one query

    UPDATE myTable SET posX='39' WHERE id IN('2','3','40');
    

提交回复
热议问题