I register user via Facebook Login Authentication
and works well.
I store facebook_id
, facebook_email
and facebook_birthday
.
Here is the query that I would like to run;
Case 1: If this user has facebook_id which exist in MySQL, update facebook_email and facebook_birthday (in case of they change)
Case 2: If this user's facebook_id is not exist in MySQL, insert into facebook_id, facebook_email and facebook_birthday
I tried this but didn't happen. Thanks in advance.
SELECT facebook_id
CASE (SELECT COUNT(*) FROM user_facebook WHERE facebook_id = 123123123)
WHEN 0 THEN INSERT INTO user_facebook (facebook_id) VALUES (1233)
WHEN 1 THEN UPDATE user_facebook SET facebook_email = "123@gmail.com"
ELSE
END
FROM user_facebook