MySQL子查詢結果集是否有記錄

Markurl

SELECT
    tu.id userId,
    tu.avatar_url avatarUrl,
    tu.wx_nick_name wxNickName,
    tu.city city,
    (select dict_label from sys_dict_data where dict_type = 'sys_user_sex' and dict_value = tu.sex) sex,
    if(1 = (select 1 from sys_user where phonenumber = tu.mobile limit 1), '代理', '用戶') userDesc
FROM
    t_wx_user tu

:)spa

相關文章
相關標籤/搜索