lundi 25 mai 2015

MYSQL, where if exists

I have 3 tables. User, alert and pref. User is obviously my user info table. Alert is my table where I store user alert/notification settings and pref is where I store my user preferences.

Not all users will have entries for prefs and alerts. When I'm trying to make a call for my alerts I'm running into trouble with my SQL knowledge.

I'm trying to do a 3 way join on user, alert and pref where the uid's are the same. I want to Select all user.id and ignore all uids that have an alert.deleted and pref.deleted = 1

    user    |    alert    |    pref
id           uid           uid
             alert_id      pref_id
             deleted       deleted

Aucun commentaire:

Enregistrer un commentaire