This is my SQL:
WHERE
CASE
WHEN (UC.USER = SESSION_USER() AND UC.full_access = 1)
THEN (FROS.IsVoided = false)
ELSE (FROS.IsVoided = false AND UC.USER = SESSION_USER())
END
I need that IF user = to (current session user) and full_access = 1 the display X else Y, I can provide more code and tables, but from general view, can someone find any common mistakes which I have done?
As alternatively I have this idea:
WHERE
IF(UC.USER = SESSION_USER() AND UC.full_access= 1, FROS.IsVoided = false, FROS.IsVoided = false AND UC.USER = SESSION_USER())
WHat is the correct way of using if statement inside WHERE clause?
Aucun commentaire:
Enregistrer un commentaire