虾米问问题了,大米们留步拉!:)))()
table1
product_no product_id prod_addr
table2
product_id obj_id
table3
connect_id connect_code
table4
phone_no cust_id
table5
cust_id cust_name
条件
where table1.product_id=table2.product_id
table2.obj_id=table3.connect_id
table4.cust_id=table5.cust_id
table4.phone_no=table1.product.no
结果
table1.prod_addr table1.product_no cust_name table3.connect_code
_________________ __________________ ___________ ____________________
select a.prod_addr,a.product_no,c.connect_code,e.cust_name
where
a.product_id=b.product_id
and b.obj_id=c.connect_id
and d.cust_id=e.cust_id
and d.phone_no=a.product_no
from table1 a,table2 b,table3 c,table4 d, table5 e
得到结果出现N条重复的记录
请问我写的这个查询问题在哪?
象是出现笛卡儿乘积现象。
如何改,谢谢了!
急等!
问题点数:20、回复次数:2Top
1 楼wffffc(飞)回复于 2006-03-04 14:35:31 得分 0
select a.prod_addr,a.product_no,c.connect_code,e.cust_name
from table1 a,table2 b,table3 c,table4 d, table5 e
where
a.product_id=b.product_id
and b.obj_id=c.connect_id
and d.cust_id=e.cust_id
and d.phone_no=a.product_no
这样试试看Top
2 楼liuex1235(盲流)回复于 2006-03-04 14:46:47 得分 0
select a.prod_addr,a.product_no,c.connect_code,e.cust_name
from table1 a,table2 b,table3 c,table4 d, table5 e
where
a.product_id=b.product_id
and b.obj_id=c.connect_id
and d.cust_id=e.cust_id
and d.phone_no=a.product_no
呵呵,不好意思,纠正一下!Top




