sql - UPDATE query with multiple criteria and subqueries -
i trying change data table multiple criteria sub-query this:
update field0 f0 set f0.c=iif(table.field="x","a",iff(table.field="y","b","c")) ( select f2.b field (field1 f1 inner join field2 f2 on f1.a=f2.a) inner join field0 f00 f00.a=f1.a ) table ;
but it's not working, says have problem how wrote query.
i tried this:
update field0 f0 set f0.c=iif(f0.a=any( select f1.c field1 f1 inner join field2 f2 on f1.a=f2.a f2.b=4),"a",iif(f0.a=any( select f1.c field1 f1 inner join field2 f2 on f1.a=f2.a f2.b not null),"b","c")) ;
but 1 says query not updatable query :/
i dont know do, help?
this actual code wroth: update flights f set f.status = (select iif(de.handeling_code=4,"canceled",iif(de.handeling_code not null,"on time ","late")) irregular_events ie inner join delay_event de on ie.ie_code=de.delay_code ie.flight_code=f.flight_code order f.flight_code);
tried says when want use query:"the action must use updateable query"
also data of flights table(in simplified way): flight_code|flight_status -----------|------------- 1 | on time 2 | on time 3 | on time 4 | on time
irregular_event table that: ie_code|flight_code -------|----------- 1 | 2 2 | 4
delay_event table that: delay_code|delay_reason ----------|------------ 1 | 1 2 | 4
delay reasons 1 3 delay , 4 canceled flight need change flight 2 status delayed , flight 4 canceled.
sorry messy question first time here , needed on matter please got easy me!
error second iif, have iff , missing closing paren nested iif.
maybe should use in :
update field0 f0 set f0.c=iif(table.field="x","a",iif(table.field="y","b","c")) b in ( select f2.b field (field1 f1 inner join field2 f2 on f1.a=f2.a) inner join field0 f00 f00.a=f1.a)
Comments
Post a Comment