Sorry that I'm completely clueless about this. But what I'm trying to do is this:
Under a table, I have two columns, group_1 and group_2. I want to run a daily event where if group_1 and group_2 have the same value 12, group_2 becomes empty.
This is the awful piece of code I have:
BEGIN
IF GROUP_1 = 12 AND GROUP_2 = 12 THEN
UPDATE GROUP_2 SET GROUP_2 = ''
END IF;
END
Any help would be appreciated :)
UPDATE 1:
Someone suggested using CASE function. This is what I came up with. Still no luck:
SELECT member_group_id, mgroup_others,
CASE
WHEN member_group_id = 12 AND mgroup_others = 12
THEN SET mgroup_others = ''
END
FROM core_members;
Aucun commentaire:
Enregistrer un commentaire