oracle 语句

来源:百度知道 编辑:UC知道 时间:2024/05/10 10:52:59
我要查寻数据库里单位的采集情况!要2008年采集了,但是09年没有采集的!
在线等啊!!

select t.* from table_name t where t.unit in (select unit from table_name where time = 2008) and t.unit not in (select unit from table_name where time = 2009)

你可以试下,不行的话可以先把要求说详细点,这个语句是oracle里的

select * from 单位信息表 where 单位ID IN (SELECT 单位ID FROM 2008年采集表) and not in (SELECT 单位ID FROM 2009年采集表)

需要你的表结构和示例数据

啥意思啊,加一个where条件?