Ir al contenido

Si <cond1> es TRUE, devuelve <expr1>. De lo contrario, si <cond2> es TRUE, devuelve <expr2>, y así sucesivamente.

func.if_(<cond1>, <expr1>, [<cond2>, <expr2> ...], <expr_else>)
func.if_((1 > 2), 3, (4 < 5), 6, 7)
┌─────────────────────────────────────┐
│ func.if_((1 > 2), 3, (4 < 5), 6, 7) │
├─────────────────────────────────────┤
│ 6 │
└─────────────────────────────────────┘
IF(<cond1>, <expr1>, [<cond2>, <expr2> ...], <expr_else>)
SELECT IF(1 > 2, 3, 4 < 5, 6, 7);
┌───────────────────────────────┐
│ if((1 > 2), 3, (4 < 5), 6, 7) │
├───────────────────────────────┤
│ 6 │
└───────────────────────────────┘