Mysql Merge 2 Columns in table but prefer first column value over second -
i have 2 column in database like:
omi | iut | final ------------------------------------------------ 98234 | | | v3455 | 09876 | v5537 |
i have column "final" empty , want merge these 2 column in third column like"
omi | iut | final ------------------------------------------------ 98234 | | 98234 | v3455 | v3455 09876 | v5537 | 09876
so
if omi empty .. take iut value
if iut empty .. take omi value
if both have values, take omi value
any help?
update tablename set final=if(omi='',iut,omi);
Comments
Post a Comment