select * from table1 t1
where t1.D = (select max(t2.D)
from table1 t2
where t2.A in ('STERE', 'KG')
)
union all
select * from table1 t3
where where t2.A not in ('STERE', 'KG')
;
where t1.D = (select max(t2.D)
from table1 t2
where t2.A in ('STERE', 'KG')
)
union all
select * from table1 t3
where where t2.A not in ('STERE', 'KG')
;
解决方案 »
- (在线坐等)ibatis里面怎样将下面SQL语句写成XML文件
- 使用日期当的问题
- oci 执行sql问题。
- 初学 PL/SQL 请教一个函数实现IP地址转换。。 100分
- oracle.sql.CLOB这样调用为什么不行?急
- 请问高人,如何看STATSPACK报告中的一些参数?
- ORACLE pl/sql 中没有没有办法知道执行的时间,I/O统计信息
- 求教oracle备份文件dmp导入数据库,头验证错误问题
- oracle报错:包阅读程序失败?求大神帮帮忙
- 如何编写一个汇总服务,从一个表中取想要的字段oracle数据库
- SQL中Group By的一些问题。
- 请教高手这样需求的SQL语句应该怎么写?
from table1 t1
where t1.D =
(select max(t2.D) from table1 t2 where t2.A in ('STERE', 'KG'))
AND T1.A IN ('STERE', 'KG')
union all
select *
from table1 t3
where where t2.A not in ('STERE', 'KG');