非常感谢 nice2u回答了我问的SQL问题, it works!

附nice2u的CODE, 在SAS环境下也work了.

select min(begdate),enddate

from (

select begdate,
enddate
from sometable
where enddate = (
select max(enddate)
from sometable
)
)
group by
enddate

所有跟帖: 

u r welcome -cowgg- 给 cowgg 发送悄悄话 (0 bytes) () 11/30/2009 postreply 20:11:30

学习。没想到sql这么powerful -tigersclaws- 给 tigersclaws 发送悄悄话 tigersclaws 的博客首页 (18 bytes) () 11/30/2009 postreply 21:42:27

这跟 -烟仔哥- 给 烟仔哥 发送悄悄话 烟仔哥 的博客首页 (72 bytes) () 12/01/2009 postreply 10:10:07

对应每个满足条件的endate,找到对应的,最早的begindate -猪不才- 给 猪不才 发送悄悄话 (0 bytes) () 12/01/2009 postreply 10:35:44

if looks like if... -HappyNow?!- 给 HappyNow?! 发送悄悄话 HappyNow?! 的博客首页 (101 bytes) () 12/01/2009 postreply 10:36:42

:) -烟仔哥- 给 烟仔哥 发送悄悄话 烟仔哥 的博客首页 (0 bytes) () 12/01/2009 postreply 11:35:08

sorry, you are right. They are the same thing unless -猪不才- 给 猪不才 发送悄悄话 (22 bytes) () 12/01/2009 postreply 10:44:23

Tel. # again? -- -:)))!!! -HappyNow?!- 给 HappyNow?! 发送悄悄话 HappyNow?! 的博客首页 (0 bytes) () 12/01/2009 postreply 10:53:47

呵呵,那你承认了先? -猪不才- 给 猪不才 发送悄悄话 (0 bytes) () 12/01/2009 postreply 10:58:45

那应该用sometable and someothertable,这就不会混肴了 -烟仔哥- 给 烟仔哥 发送悄悄话 烟仔哥 的博客首页 (0 bytes) () 12/01/2009 postreply 11:34:35

can u elaborate ur issue again? -撅着挺好- 给 撅着挺好 发送悄悄话 (41 bytes) () 12/01/2009 postreply 14:24:40

回复:非常感谢 nice2u回答了我问的SQL问题, it works! -jinyouzi- 给 jinyouzi 发送悄悄话 (151 bytes) () 12/01/2009 postreply 18:36:07

请您先登陆,再发跟帖!