SQL菜鳥請教初級+sql問題(類似上題,有些變動),在線等...

我用min max 去選兩個時間中最小和最大的。如:
record#: begdate endate
3. 1/1/05. 6/30/06
4. 1/1/07. 12/31/09

我希望的結果是:
1/1/07 - 12/31/09
請問如何實現,而且output是date variable.
非常感謝!

所有跟帖: 

你的記錄3和4各自代表什麽呀?logic,你為什麽這麽截斷? -veggiedoggie- 給 veggiedoggie 發送悄悄話 veggiedoggie 的博客首頁 (0 bytes) () 11/06/2009 postreply 10:29:50

你是否想要MAX BEGDATE和MAX ENDDATE? -:-}---~- 給 :-}---~ 發送悄悄話 :-}---~ 的博客首頁 (0 bytes) () 11/06/2009 postreply 10:36:14

好象是,嗬嗬,小謀這個IQ題:觀察,然後總結規律。 -veggiedoggie- 給 veggiedoggie 發送悄悄話 veggiedoggie 的博客首頁 (0 bytes) () 11/06/2009 postreply 10:38:24

忘了說明一下,3和4中間有間斷,這種情況取most recent時間段。 -小謀- 給 小謀 發送悄悄話 小謀 的博客首頁 (0 bytes) () 11/06/2009 postreply 10:47:14

回複:忘了說明一下,3和4中間有間斷,這種情況取most recent時間段。 -veggiedoggie- 給 veggiedoggie 發送悄悄話 veggiedoggie 的博客首頁 (27 bytes) () 11/06/2009 postreply 10:53:49

好像需要先加一個判斷,再決定用哪個. -小謀- 給 小謀 發送悄悄話 小謀 的博客首頁 (0 bytes) () 11/06/2009 postreply 11:01:29

你是要找出現最多的最老的日子把?那就複雜多了 -:-}---~- 給 :-}---~ 發送悄悄話 :-}---~ 的博客首頁 (31 bytes) () 11/06/2009 postreply 11:09:31

how to use IF statement in SQL, and compare the current -小謀- 給 小謀 發送悄悄話 小謀 的博客首頁 (32 bytes) () 11/06/2009 postreply 11:10:44

as long as i know, u can't use if in proc sql; -veggiedoggie- 給 veggiedoggie 發送悄悄話 veggiedoggie 的博客首頁 (0 bytes) () 11/06/2009 postreply 11:14:47

SQL不能比較current and previous record value -:-}---~- 給 :-}---~ 發送悄悄話 :-}---~ 的博客首頁 (33 bytes) () 11/06/2009 postreply 11:15:13

you can use case for if...then...else...if...then...else -:-}---~- 給 :-}---~ 發送悄悄話 :-}---~ 的博客首頁 (45 bytes) () 11/06/2009 postreply 11:18:27

高人呐,我趕緊做筆記,嗬嗬。 -veggiedoggie- 給 veggiedoggie 發送悄悄話 veggiedoggie 的博客首頁 (104 bytes) () 11/06/2009 postreply 11:27:00

說笑了,俺剛古狗來的:) -:-}---~- 給 :-}---~ 發送悄悄話 :-}---~ 的博客首頁 (0 bytes) () 11/06/2009 postreply 11:30:56

too complicated. -小謀- 給 小謀 發送悄悄話 小謀 的博客首頁 (0 bytes) () 11/06/2009 postreply 11:34:53

沒先謝謝人家? -眼冒金星- 給 眼冒金星 發送悄悄話 眼冒金星 的博客首頁 (0 bytes) () 11/06/2009 postreply 11:56:25

先謝了 -小謀- 給 小謀 發送悄悄話 小謀 的博客首頁 (0 bytes) () 11/06/2009 postreply 12:40:26

:) -眼冒金星- 給 眼冒金星 發送悄悄話 眼冒金星 的博客首頁 (0 bytes) () 11/06/2009 postreply 13:12:54

回複:SQL菜鳥請教初級+sql問題(類似上題,有些變動),在線等... -Wonderfullife70- 給 Wonderfullife70 發送悄悄話 (51 bytes) () 11/06/2009 postreply 14:19:00

回複:SQL菜鳥請教初級+sql問題(類似上題,有些變動),在線等... -nice2u- 給 nice2u 發送悄悄話 (293 bytes) () 11/10/2009 postreply 14:38:35

請您先登陸,再發跟帖!