急急急!Oracle数据库查询,查询今年在上一年出现过的数据,还有上一年的所有数据。,急求!!!!!!!
发布网友
发布时间:2022-04-07 22:18
我来回答
共3个回答
热心网友
时间:2022-04-07 23:48
select * from 表名 where insert_time=2013
union all
select * from 表名 where insert_time=2014 and company in (select company from 表名 where insert_time=2013)
这个意思?
热心网友
时间:2022-04-08 01:06
select * from tname where insert_time = 2013
union all
select * from tname where insert_time = 2014 and exist(select 1 from tname t2 where t2.insert_time = 2013 and tname.company_id = t2.company_id)
热心网友
时间:2022-04-08 02:40
假定表名为:abc ,
select id ,company_id ,insert_time from abc where insert_time='2013'
union all
select id ,company_id ,insert_time from abc a,abc b where b.insert_time='2014' and
b.company_id =a.company_id and a.insert_time='2013' ;
这个尝试下。