Update row where ID matches other table

2012-01-02  Source: Original Site  Category:MySQL  Views:1 

Advertisement

Okay, so I have 2 tables, mos_users & mos_tempban .
mos_tempban contains 2 columns: ID & lastvisitdate (last one is not so relevant)
mos_users contains 13 columns, only 2 importent: ID & block

What I am trying to do is: I want to set Block = '1' in mos_users where ID from mos_tempban & mos_users match... How do I do this correctly? I tried

UPDATE mos_users SET block = 1 WHERE mos_users.id IN (select id FROM mos_tempban)

But then the database server started to crash...

Jelle

Related articles
  • Update row where ID matches other table 2012-01-02

    Okay, so I have 2 tables, mos_users & mos_tempban . mos_tempban contains 2 columns: ID & lastvisitdate (last one is not so relevant) mos_users contains 13 columns, only 2 importent: ID & block What I am trying to do is: I want to set Bloc

  • Need to update columns with values from other tables 2013-12-15

    Here is the situation: There is a process that receives a file from a vendor , formats the data and loads it to EMPL table. EMPL table contains among others Zip_cd and Zip_loc columns and Dept_cd and Dept_name columns. Zip_cd and Zip_loc columns are

  • Oracle How to insert rows in chunk from other table? 2012-05-27

    I am trying to insert rows from one schema table to other schema table. I have to inserts approximately more than 500,000+ rows every month. But when I insert row into that table it has to update many other database objects by means of trigger. I can

  • UPDATE rows WHERE array[] ? 2013-08-10

    I have two tables A and B. I want to update rows in Table A depending on the back up data stored in Table B. Table A = most current table of dataTable B = 5 day old back up of table A Structure of both Table A and B: item_id(unique int), item_type(in

  • Oracle How to update Column with Data from Other Table. 2015-01-12

    I have one table <teledetail> in which t_name is one field, I have added one column t_code. I want to update t_code with the field <p_code> from party table. teledetail t_name (having data which are there in party table) t_code (blank, wa

  • Oracle Updated rows not found in other workspace 2012-10-16

    I have LIVE and WM_PREVIEW workspaces. Before making any updates to a row, it is accessible from both workspaces. Once a row updated in one workspace, I would expect non updated version to be available in other workspace. Instead the entire row total

  • Oracle Update Trigger with Value from Other Table 2014-12-13

    I need to sum Item Y from TableB and insert/update that value into X Field in TableA. I can do this with regular select statements when i add the values in my statement but im getting errors now. Help needed on how to code the trigger for this, thank

  • Oracle Update value with value in other table. 2013-04-23

    Hi I need help uppdating a value in on table depending on a value in another table. In table "MEMBERSHIPS" I have a column called "LEVEL" this can contain 3 different values; Gold, Silver & Blue. (Predefined in table "ENTITY_DETAILS") In another

  • Oracle updating data based from a other table 2013-08-28

    Hi, i would like help. I donĀ“t know how i can start to do: I have a table with a column with some numbers (Primary Key) and i need to create other column with same values, I want to change a table that has only a numeric values (PK) to another value,

  • auto update field with data from other table 2012-01-29

    HI, i'am an newbie and have following question I have two tables 1. repair_details with fields partnumber, quantity, Pn_id 2. Parts with fields Pn_id, price, partnumber.... I would like to fill in repair_details the Pn_id automaticly after I input th

  • Oracle trivial ==> UPDATE where in other table 2014-11-05

    Hi Sorry , but How can I to do a Update when Where is in other table, How can I to do join ?

  • Update rows with ID in array (and more) 2012-12-23

    Ok, so I'm making a registration form system, where I can create new registration forms for the users to pick a date etc. In my form I can add and remove text fields via Javascript - to add additional dates etc. so I don't know if I'll be submitting

  • SQL problem: updating a table's columns with other table's row's data 2012-06-25

    I am have a MySQL database and need to insert/update a table (T3) using data from two other tables (T1 & T2). T3 should have 2 columns (PID & Name) which match 2 columns in T1, with additional columns based on the row values of T2. A simple "

  • Update all null data in a table where columns match 2012-11-01

    i have posted this somewhere else but have had little response so trying to broaden my help request. I have a small problem where i have 2 seperate tables Table 1 (tstockout) Table 2 (tRemoved) In Table 1 Field Names: Date, Time, PartNo, Qty, Phase,

  • MySQL Is this possible: Update other tables rows when another table/row is changed? 2012-02-22

    From what I am just getting from Triggers, it looks like this is possible, but want to make sure I am understaning this correctly. I have one master account table. If i change a column named 'active' in that table to '0' i want other tables that refe

  • Oracle Updating a table's record with values from other tables 2013-07-20

    i have problem: updating a table with values from other tables. this is the tables' schema: service(id int primary key, total_price int) service_charge(id int primary key, part_id int (foreign key to part.id), srv_id int (foreign key to service.id),

  • Oracle Help on triggers needed-update other tables 2013-07-28

    Hi, I am using 10g and is very new to triggers and I hope I can gain some advises here. I have the following 3 tables. MainInterfaceTable is a table where it stores records of values which are to be updated to tables: log1 and log2 respectively. One

  • Oracle Update table from other table HAVING NO PRIMARY KEY CONSTRAINT 2013-09-14

    i want to update one table form an other table, for example SQL> select * from zz; X VALU ---- 25 abc 18 xyz 14 uvw 12 uvw 26 abc 12 uvw 30 asdf 14 uvw 22 kmn SQL> select * from xy; X 12 14 18 22 14 30 25 12 26 9 rows selected we have two table

  • MySQL Update rows of same table with trigger 2014-05-24

    I have the need to update rows of a table by a trigger which is activated by another row of the same table. This does not work and error 1442 will occure: ERROR 1442: Can't update table 'x' in stored function/trigger because it is already used by sta

  • Oracle Update table from other table 2014-06-27

    i want to update one table form an other table, for example SQL> select * from zz; X VALU ---------- ---- 25 abc 18 xyz 14 uvw 12 uvw 26 abc 12 uvw 30 asdf 14 uvw 22 kmn SQL> select * from xy; X ---------- 12 14 18 22 14 30 25 12 26 9 rows sele