日期:2014-05-16  浏览次数:20772 次

帮忙找出答案??
写一个sql,表tab1字段A、B、C,C为创建时间,B为数字型,找到B在100到1000之间,创建时间最大的记录

我自己的弄的答案:Select * from(select rownum,A,B,C FROM tab1 where B between 100 and 1000 order by C) rownum =1;

现不知道这句是不是正确的,请高手指教,谢谢

------解决方案--------------------
select max(C) FROM tab1 where B between 100 and 1000 order by C
or
select * from (
select rownum,A,B,C FROM tab1 where B between 100 and 1000 order by C) a 
order by b desc limit 1
------解决方案--------------------
贴建表及插入记录的SQL,及要求结果出来看看
------解决方案--------------------
SQL code
select  *
from tb1 T1
where T1.B between 100 and 1000
order by C desc
limit 1

------解决方案--------------------
select * from 表tab1 where B between 100 and 1000 order by C desc limit 1
------解决方案--------------------
SQL code
SELECT *
FROM 
tab1
WHERE b BETWEEN 100 AND 1000 
ORDER BY c DESC LIMIT 1;