Mhanaz Syed Mhanaz Syed - 1 year ago 69
SQL Question

how to updated table with dynamic data in where conditioner in mysql

i am trying to Updated view using this query :

UPDATE tableview SET status = 1 where event_id in (SELECT eventsId
FROM tableview2 where status <>1)

using this Query i am getting 1,2,3,4

SELECT eventsId
FROM tableview2 where status <>1

but when i try to Updated it show more than one column operand please suggest me how to Updated it

Answer Source

it will work for you

  UPDATE tableview v1
    inner join  tableview2 v2 on v1.event_id =v2.event_id
    SET status = 1 
    where v2.status<>1
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download