-1

I am working in mySQL. It's a table of members, some are inactive, I want to change the status of inactive ones from active to inactive. So I know i need to SET active=0 WHERE member=x but I have 382 rows to change (multiple values of x)

Hope this makes sense, I am a noob!

Ian Eagle
  • 3
  • 1
  • 1
    Possible duplicate of [Multiple Updates in MySQL](https://stackoverflow.com/questions/3432/multiple-updates-in-mysql) – Obsidian Age Nov 29 '17 at 19:30
  • You would define a `WHERE` clause which includes all of the target rows. What logic identifies all of the rows? – David Nov 29 '17 at 19:30
  • Thanks, the rows I want to change are certain member numbers, e.g. members 2,17,236,4285 (but 382 entries) – Ian Eagle Nov 29 '17 at 19:35

1 Answers1

1

You can use in

update myTable SET active=0 WHERE member in (, , , , ,);

If you have some logic than can select those members then you can add it to your query.

update myTable SET active=0 WHERE member in 
 (select members from myTbale where --- add your logic to get the members---); 
isaace
  • 3,336
  • 1
  • 9
  • 22