Re: Enum Toggle
�ke Lagercrantz wrote:
> Hey!
>
> I've got a 2 option enum variable, say yes/no.
>
> What I want to do is to toggle this enum with a single push of a button (a single update query).
DROP TABLE IF EXISTS foo;
CREATE TABLE foo (id INT NOT NULL PRIMARY KEY, yn ENUM('y', 'n'));
UPDATE foo SET yn = IF(yn = 'y', 'n', IF(yn = 'n', 'y', yn)) WHERE id = <<some_id>>;
--
felix
Please use
BBCode to format your messages in this forum.
Subject
Written By
Posted
Re: Enum Toggle
May 17, 2005 08:03AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.