就是PL/SQL,和SQL SERVER里的SQL语句因该差不多的。

解决方案 »

  1.   

    AND 对象金额〈金额(金额最小的那条记录。)
    如果对象金额=30,抽出的纪录为:
    20040301   1    60         C
    这个对象金额的条件没看懂,如果楼主是为了oracle上运行,建议转到oracle版
      

  2.   

    //开始日=(20041231日这一年最新的那个日子)
    AND 对象金额〈金额(金额最小的那条记录。)什么意思﹖
    為什么不是這條記錄﹖20040101   1    20         A
      

  3.   

    sql写法select * from tablename
    where 开始日=(select max(开始日) from tablename where 开始日<='20041231' and 开始日>='20040101')
    and SEQ=(select top 1 SEQ from tablename where 开始日=a.开始日 order by 金额)可惜在oracle下肯定不行
      

  4.   

    写错了select * from tablename a
    where 开始日=(select max(开始日) from tablename where 开始日<='20041231' and 开始日>='20040101')
    and SEQ=(select top 1 SEQ from tablename where 开始日=a.开始日 order by 金额)
      

  5.   

    对象金额?是不是这样?
    select * from tablename a
    where 开始日=(select max(开始日) from tablename where 开始日<='20041231' and 开始日>='20040101' and 金额>=30)
    and SEQ=(select top 1 SEQ from tablename where 开始日=a.开始日  and 金额>=30 order by 金额)
      

  6.   

    select * from test where qian=(select min(qian) from test where somedate=(select max(somedate) from test where somedate<'20050101'))
      

  7.   

    懒得打中文了,'qian'就是金额,'somedate'就是日期。
      

  8.   

    select top 1 a.* 
     from 表 a
    where [开始日]<='20041231' 
      and [金额]>=30
    order by [开始日] desc ,[金额] asc