From surenkid, 3 Weeks ago, written in MySQL.
Embed
  1. SELECT u.*,ru.type,ru.uuid,ru.mobile,ru.logins,rub.realname, rub.gender, rub.wx_name, rub.plat_name FROM (
  2.         SELECT uid,utypes,usid,nickname,icon,unionid
  3.         FROM `lk_user_thirdparty` a
  4.         WHERE uid>0 -- and unionid <>'' and unionid <>'undefined'
  5.         GROUP BY uid
  6. ) u
  7. LEFT JOIN lk_user ru ON u.uid = ru.uid
  8. LEFT JOIN lk_user_basic rub ON u.uid = rub.uid