I have the following tables:
PROFILE table {
user_id INT, 
apitype enum('facebook' , 'main')
}
USER table {
id INT
}
PROFILE.user_id is a foreign key that points to the ID in USER table, but only if PROFILE.apitype =  'main'
so basically PROFILE.user_id does not refer to an ID in the USER table if PROFILE.apitype != 'main'
How can I accomplish this in MYSQL?
 
     
     
     
     
    