문제

How can I deactivate a row instead of deleting it, using flag values in MySQL?

올바른 솔루션이 없습니다

다른 팁

Add an active column to the table, and then do:

UPDATE YourTable
SET active = 0
WHERE id = :id

to deactivate the row. You'll then need to update all other queries so they do:

WHERE active = 1

There's no built-in mechanism that does this automatically.

You can create a column in your table as type CHARACTER(1), and use something like 'A' for active and 'D' for deactivated.

There isn't a "flag value" for mysql, people refer to it as a flag, as they created the flag within their own tables for use as such.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top