日期:2014-05-18 浏览次数:20421 次
--加 distinct 过滤掉重复的 select distinct firesystype.tiSysType,firesystype.vSysdesc from firesystype left join devicetype on firesystype.tiSysType=devicetype.tiSysType left join devices on devicetype.tiDeviceType=devices.tiDeviceType left join gateway on gateway.Gatewayaddress=devices.Gatewayaddress where gateway.orgid='201201020100009'
------解决方案--------------------
firesystype left join devicetype on firesystype.tiSysType=devicetype.tiSysType
left join devices on devicetype.tiDeviceType=devices.tiDeviceType
left join gateway on gateway.Gatewayaddress=devices.Gatewayaddress
在于这里,四个表,按照关联条件查出来的数据应该有重复的,就是说其中有可能存在 一对多 的情况