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

请您先登陆,再发跟帖!