您现在的位置:动易网络>> 帮助文档>> PowerBuilder>>正文内容

符合条件的最小记录

问:

想查找符合qfno='100101' 条件, 且日期whdate为最小的记录,但用下面语句
SELECT * FROM SEAL where qfno='100101' and whdate in (select min(whdate) from seal )
出现日期为库内最小才查得出来,不知道哪里错误,请高手指教。

答:

SELECT a.* FROM SEAL a
where a.qfno='100101' and a.whdate in (select min(whdate) from seal where qfno =a.qfno )

select top 1 * from seal where qfno = '100101' order by whdate asc

 


感动 同情 无聊 愤怒 搞笑 难过 高兴 路过
【字体: 】【收藏】【打印文章】【查看评论

相关文章

    没有相关内容