Skip to content

Instantly share code, notes, and snippets.

@hectorperez
Created May 29, 2014 09:11
Show Gist options
  • Select an option

  • Save hectorperez/dd6bb9f359a12face93f to your computer and use it in GitHub Desktop.

Select an option

Save hectorperez/dd6bb9f359a12face93f to your computer and use it in GitHub Desktop.
Variables in MySQL - set @variable, GROUP_CONCAT & FIND_IN_SET
set @checked=(select GROUP_CONCAT(id) from table_name where atribute_name=1);
UPDATE table_name
set atribute_name=0
where FIND_IN_SET(id,@checked)>0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment