有sql高手吗?能不能帮我看下这个sql语句又没有别的写法总感觉很怪!
select ms.uid,ms.lastip,mmc.username,mmc.extcredits4 from pre_common_member_status as ms left join (select m.uid,m.username,mc.extcredits4 from pre_common_member as m left join pre_common_member_count as mc on mc.uid=m.uid where m.uid='1439' and mc.uid is not null) as mmc on ms.uid=mmc.uid where m.uid='1439'
select ms.uid,ms.lastip,mmc.username,mmc.extcredits4 from pre_common_member_status as ms left join (select m.uid,m.username,mc.extcredits4 from pre_common_member as m left join pre_common_member_count as mc on mc.uid=m.uid where m.uid='1439' and mc.uid is not null) as mmc on ms.uid=mmc.uid where m.uid='1439'
from pre_common_member_status ms
left join pre_common_member m on ms.uid=m.uid
left join pre_common_member_count mc on mc.uid=m.uid
where ms.uid='1439' and mc.uid is not null
需要查询 pre_common_member(username),
pre_common_member_count(extcredits4),
pre_common_member_status(lastip),
他们用一个共有的字段uid
我要查询出来的结果 :uid lastip username extcredits4
1439 60.170.0.70 wodentt 984 想知道还有没有比我这样写简单的sql语句了
from pre_common_member_status ms
inner join pre_common_member m on ms.uid=m.uid
inner join pre_common_member_count mc on mc.uid=m.uid
where ms.uid='1439'
from pre_common_member_status as ms
inner join (
select m.uid
from pre_common_member as m
inner join pre_common_member_count as mc
on mc.uid=m.uid
where m.uid='1439'
) as mmc
on ms.uid=mmc.uid