附nice2u的CODE, 在SAS環境下也work了.
select min(begdate),enddate
from (
select begdate,
enddate
from sometable
where enddate = (
select max(enddate)
from sometable
)
)
group by
enddate
非常感謝 nice2u回答了我問的SQL問題, it works!
所有跟帖:
• u r welcome -cowgg- ♂ (0 bytes) () 11/30/2009 postreply 20:11:30
• 學習。沒想到sql這麽powerful -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?!- ♂ (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?!- ♂ (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- ♀ (151 bytes) () 12/01/2009 postreply 18:36:07