不太难的sql查询请教
表1:place
字段:ID,IP,NAME
表2:equipment
字段:EID,EIP,NAME
equipment中的数据是place中的数据的子集。
现要查询出来,place中还有那些数据没有出现在equipment中。
即要查出来 place中哪些 ID,IP,NAME这样的组合没有出现在equipment中。
没咋学过sql,不太会。
也不知道说的是否清楚~
------解决方案--------------------select a.* from place a,equipment b where a.id <> b.eid and a.ip <> b.eip and a.name <> b.ename
------解决方案-------------------- Select * From place A
Where Not Exists(Select EID From equipment Where EID = A.ID And EIP = A.IP And NAME = A.NAME)
------解决方案--------------------应该是
select a.* from place a where not exists(select * from equipment b where a.id=b.eid and a.ip=b.eip and a.name =b.ename)
------解决方案--------------------试试这个
select * from place where checksum(id,ip,name) not in (select checksum(EID,EIP,NAME) from equipment)