关于一个SQL语句 谢谢
SELECT see_ok,mail_time,mail_id,mail_title,mail_from FROM [mail_to] WHERE mail_to= 'xx
SELECT see_ok,mail_time,mail_id,mail_title,mail_from,member_base.member_id FROM [mail_to] INNER JOIN
member_base on mail_to.mail_from=member_base.member_name WHERE [mail_to].mail_to= 'xx '
请问为什么查询的结果是不同的了?
要怎么才能是相同的查询结果? 谢谢
刚开始那个帖子没分
------解决方案--------------------你加了条件:on mail_to.mail_from = member_base.member_name
应该是member_base里面的mail_from 比 mail_to 少.
可尝试用left join
SELECT a.see_ok,a.mail_time,a.mail_id,a.mail_title,a.mail_from,b.member_id FROM [mail_to] a
left join member_base b
on a.mail_from = b.member_name WHERE a.mail_to= 'xx'