SQLite conditional insert or replace

前端 未结 1 1242
南方客
南方客 2021-01-21 18:13

I\'m trying to insert or update a record into a sqlite database, and only update the value if the new value is greater than the old.

The schema is:

 CREA         


        
相关标签:
1条回答
  • 2021-01-21 18:52

    Try

    INSERT OR REPLACE INTO SearchTable(Owner, Generations)
    SELECT ?, MAX(Generations) FROM SearchTable WHERE Owner = ?
    
    0 讨论(0)
提交回复
热议问题