mysql if(expr1,expr2,expr3)
i want use 2 sentences expr2 or expr3. possible? or there way?
select @a:=0, @b:=0, @c:=0 ,if(1>0 , @a:=1 , @b:=2, @b:=9 , @c:=8) if_r, @a,@b,@c dual
it seems work , outputs:
+-------+-------+-------+------+------+------+------+ | @a:=0 | @b:=0 | @c:=0 | if_r | @a | @b | @c | +-------+-------+-------+------+------+------+------+ | 0 | 0 | 0 | 1 | 1 | 2 | 0 | +-------+-------+-------+------+------+------+------+
but
select @a:=0, @b:=0, @c:=0 ,if(1>2 , @a:=1 , @b:=2, @b:=9 , @c:=8) if_r, @a,@b,@c dual
gives
+-------+-------+-------+------+------+------+------+ | @a:=0 | @b:=0 | @c:=0 | if_r | @a | @b | @c | +-------+-------+-------+------+------+------+------+ | 0 | 0 | 0 | 1 | 0 | 1 | 8 | +-------+-------+-------+------+------+------+------+
i want double execute @ on string this
+-------+-------+-------+------+------+------+------+ | @a:=0 | @b:=0 | @c:=0 | if_r | @a | @b | @c | +-------+-------+-------+------+------+------+------+ | 0 | 0 | 0 | 1 | 0 | 9 | 8 | +-------+-------+-------+------+------+------+------+
how query that?