QUOTE:
最初由 lonesashimi 发布
create table test
(a varchar2(1),
b date,
c number
)
其中存入数据
1 2001-01-01 300
1 2002-10-01 200
2 2001-01-01 100
现要查询a=1的max(b)对应的c,按如下方法写SQL当数据量很大时,会不会变慢
select c from test where b=(select max(b) from test where a=1)
and a=1
有别的写法吗
select test1.c from
(select c ,b from test) test1,
(select max(b) b from test where a=1) test2
where test1.b=test2.b