表1
SELECT COALESCE(EMAIL, FB_EMAIL)as EMAILId FROM o2core.t_o2_user_profile_details where USER_ID=10011;
查询1的输出是
EMAILId
bhanupriya@gmail.com
表:2
SELECT CORP_USER_ID as FROM o2core.t_o2_corp_user_reg_map as b where TH_ID=2 ;
查询2的输出是
EMAILId
bhanupriya@gmail.com
答案 0 :(得分:0)
尝试使用此查询:
SELECT COUNT(*) > 0 AS emailIsUsedTwice
FROM t_o2_user_profile_details AS p
INNER JOIN t_o2_corp_user_reg_map AS m ON m.CORP_USER_ID = COALESCE(p.EMAIL, p.FB_EMAIL)
WHERE p.USER_ID = 10011;
在t_o2_corp_user_reg_map.CORP_USER_ID