亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: 請教一個關(guān)于informix語句的問題 [打印本頁]

作者: field    時間: 2007-04-19 11:15
標(biāo)題: 請教一個關(guān)于informix語句的問題
情況是這樣的,有一個表有以下字段:
zh,fse,rq
其中有很多記錄zh字段是相同的,我只想取出其中rq最大的那條記錄的fse,請教這個語句如何寫?
作者: wenlq    時間: 2007-04-19 12:29
try
select unique zh from tab into temp tmpzh;
select a.* from tab a,tmpzh b   
where  a.zh = b.zh and rq = ( select max( rq ) from tab where zh = b.zh ) ;
作者: shanshl    時間: 2007-04-19 16:26
select tb1.fse
from tbname tb1
where tb1.rq=(select max(tb2.rq) from tbname tb2 where tb1.zh=tb2.zh)
這樣應(yīng)該可以吧
作者: john_student    時間: 2007-04-22 13:20

  1. select zh, max(rq) as maxrq
  2. from tab
  3. group by zh
  4. into temp tab_tmp ;
  5. select a.zh, a.rq, a.fse
  6. from tab a, tab_tmp b
  7. where a.zh = b.zh
  8. and a.rq = b.maxrq ;
復(fù)制代碼





歡迎光臨 Chinaunix (http://72891.cn/) Powered by Discuz! X3.2