2007年12月

原创 join 后的where你清楚吗?

今天,在对两张表进行left join时候,总是查询少结果,并不是所要的答案,原来的语句:select aa.RoomId, bb.SectionID from aa left join bb on aa.RoomId = bb.OldForumID where aa.del = 0 and bb.ParentID != '00000000' and bb.IsDeleted = 'false' group by aa.RoomId, bb.SectionID结果只显示了276条,缺少了4条结果,这4条结果中的第二列SectionID 为NULL;后来经头提点,把语句改成:select aa.RoomId, bb.SectionID from aa left join bb on aa.RoomId = bb.OldForumID and bb.ParentID != '00000000'where aa.del = 0 and bb.IsDeleted = 'false' group by aa.RoomId, bb.阅读全文>

发表于 @ 2007年12月18日 13:45:00|评论(loading...)|编辑

Csdn Blog version 3.1a
Copyright © 周兆成