select t3.aaa,t2.bbb from t3,t2 where t3.c1='aaa' and t3.c2='bbb' and t3.c1=t2.c1(+) sql如上,t3是总表(只有人名,地址等基本信息),t2是附表(这个人名下的所有房产,基本结构是人名,房产类型,价值,地址等)。t3有2条记录,t2里3条记录,怎么查询出来的结果又19条呢?
其实一共三个表,详细sql如下: select t3.aaa,t2.bbb,t1.RES_ADDR_1,t1.RES_ADDR_2,t1.res_port,t1.RES_PORT_1 from PLAN t1,t3,t2 where t3.c1='aaa' and t3.c2='bbb' and t3.c1=t2.c1(+) and t3.C8=t1.order_id
select t3.aaa,t2.bbb,t1.RES_ADDR_1,t1.RES_ADDR_2,t1.res_port,t1.RES_PORT_1
from PLAN t1,t3,t2 where t3.c1='aaa'
and t3.c2='bbb' and t3.c1=t2.c1(+) and t3.C8=t1.order_id