Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

use a condição If else para selecionar a coluna no mysql?

   SELECT IF(t1.AccountNo IS NULL, t2.TempAccountNo, t2.AccountNo) AS optional_field
     FROM table2 t2
LEFT JOIN t1 ON t1.AccountNo = t2.AccountNo