azzazzello
Technical User
I have 2 tables, one (call it F_table) with 5 fields, other (call it D_table) with 4 fields.
I have a statement
REPLACE INTO D_TABLE (a,b,c,d) SELECT (a,(if b in {3,5} use b, otherwise, use x),c,d FROM F_TABLE WHERE ...
I am not exactly sure how to embed that IF statement in there...basically, I want to copy over a,c,d fields, but as for D_TABLE.b, I want to copy into it from F_TABLE.b if b is 3,4, or 5, otherwise I want to copy into it from F_TABLE.x
I have a statement
REPLACE INTO D_TABLE (a,b,c,d) SELECT (a,(if b in {3,5} use b, otherwise, use x),c,d FROM F_TABLE WHERE ...
I am not exactly sure how to embed that IF statement in there...basically, I want to copy over a,c,d fields, but as for D_TABLE.b, I want to copy into it from F_TABLE.b if b is 3,4, or 5, otherwise I want to copy into it from F_TABLE.x