I have a table table1 which has columns o_id as PK,  ipaddress, b_id
o_id    ip              b_id
9205    10.10.10.10     null
9206    10.10.10.11     null
9207    10.10.10.12     null
---more than 1000 rows
I have another table table2 id which has columns as PK,  ipaddress, b_id, env 
id      ip              o_id  env
18356   10.10.10.10     null  dev
18357   10.10.10.11     null  prod
18358   10.10.10.12     null  qa
---more than 1000 rows
Now, if ipaddress matches in both tables and table2.env IN ('dev', 'qa'), then I want to update both tables such that table2.o_id = table1.o_id and table1.b_id = table2.id
Here I want to update o_id in second table from the o_id in first table.
I also want to update b_id in first table from id in second table.
I have written below query.
update table1 t1
inner join table2 t2 on t1.ip = t2.ip 
set t1.b_id = t2.id,
     t2.o_id = t1.o_id
where t2.env IN ('dev', 'qa')
limit 2
I am getting an error incorrect usage of limit.
I want to update only 2 rows first and see how it looks? I dont want to update the whole table all at once
 
     
    