如何把MAX()当条件?
zjlsh jysj1 220122
2 122333
3 153310
4 160233
5 190750
如何查找最大(zjlsh)对应的jysj,同时查询条件还得带jgbm=210024 and jyrq=20080301
[ 本帖最后由 oicq63236 于 2008-3-1 21:07 编辑 ] select
yjsj
from your-table
where 1 = 1
and zjlsh = (
select
max (zjlsh)
from your-table
)
and jgbm=210024
and jyrq=20080301
;
是这个意思么?
informix下只能这么写的。 嗯,是这个意思,我自己是这么写的
select first 1 a.cjgmc,jysj as lastsj from ggjgm a,lsflls where a.jgbm='$se
lect' and zjlsh in ( select max(zjlsh) from lsflls where jgbm='$select' and jyrq
='$TODAY')
想问一下ivhb兄,where 1 = 1是什么意思呢?在语句中有什么作用?
页:
[1]