Wow, that's a rare use of IF.
Basically it means that the SELECT will only pull the username from the db if the userid is not equal to zero, otherwise it will return NULL (the missing third parameter, which defaults to NULL).
Can you say 'NULL AS username' in a SELECT statement and it assign the value of NULL to username ? - I'm not sure - it might generate an error. I'm certainly not sure why you would want to do this, it seems kinda pointless.
|