php mysql update limit

后端 未结 2 1702
失恋的感觉
失恋的感觉 2021-01-23 20:57

I want to update mysql database, where directory = 0, and just update 5 of records which value 0 to art.

for explain:

2条回答
  •  Happy的楠姐
    2021-01-23 21:42

    your syntax is fine.

    i will add an order by clause (to be sure)

    ORDER BY `Id`
    

    to query

    UPDATE articles SET directory = 'art' WHERE directory ='0' ORDER BY id LIMIT 5
    

提交回复
热议问题