I want to update mysql database, where directory = 0
, and just update 5 of records
which value 0
to art
.
for explain:
Your query doesn't seem wrong to me.
But note that you might also want to specify an order by
clause, to be sure which are the five "first" items :
update articles
set directory = 'art'
where directory = '0'
order by id
limit 5
Just as a reference : UPDATE Syntax
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