jeudi 7 avril 2016

MySQL IF statement for subquery's

I'm trying to achieve this example in MySQL language (the part of the if-statement).. could anyone try and help me? I've been stuck for days now.

SELECT * FROM tblUsers

INNER JOIN
    IF function <= 1
    (
        // SELECTING ALL IF THE USERS FUNCTION TOLERATES IT (HAS PRIVILEGE TO IT)
        SELECT * FROM tblDomains
    )
    ELSE
    (
        // SELECTING A SPECIFIC VALUE
        SELECT * FROM tblDomains WHERE domain = 'example.com'
    )
ON (part continues here, ofcourse)

WHERE username = :name AND password = :password

Aucun commentaire:

Enregistrer un commentaire