出现笛卡尔积的sql语句
select * from (
select wpi.target,wpi.content,wpi.startTime,wpi.endTime,wp.month,wp.year,wp.week,wp.comment_status from wpi,wp where wpi.wk_id in(
select id from wp where userid in (
select UserNo from [user] where mobilePhone='xxx'
)
and year='2012' and month='11')) as c


正常的SQL

select * from (
select wpi.target,wpi.content,wpi.startTime,wpi.endTime,W.month,W.year,W.week,W.comment_status from wpi , wp W where wpi.wk_id =w.id and w.id=(
select id from wp where userid in (
select UserNo from [user] where mobilePhone='xxx'
)
and year='2012' and month='11') ) as d

通过对比发现 出现笛卡尔积的sql语句条件是少了一个,那就是wp id 没有明确是那个一ID值