Is there an if or if else type statement for mysql.
A:
There is an if else construct:
IF(value == x, 1, 0)
This returns 1 if value equals x and 0 otherwise.
JoshD
2010-10-12 08:58:45
is this to be used inside the mysql coding?
blah
2010-10-12 09:00:27
that's an `IF()` function and different from an `IF` statement. Just pointing out.
Ruel
2010-10-12 09:04:07
@blah, yes. You can have it as a column in a query. @Ruel: yes. I think this may be what the asker wants, if not, I'll remove it.
JoshD
2010-10-12 09:06:49
A:
As JoshD said, yes there is. Here is the reference in the MySQL Online Manual: http://dev.mysql.com/doc/refman/5.0/en/if-statement.html
Anthony Eden
2010-10-12 08:59:45
A:
Yes, there is. Reference for this and other control flow statements can be found here:
Salman A
2010-10-12 09:09:41