我有两张桌子a和b。 我想在以下两个条件下加入这两个:
一个。
ID Name Time1 Time2
1 Joe 01JAN2015:07:02:28 01JAN2015:07:49:13
2 Jenny 01JAN2015:10:06:09 01JAN2015:10:07:11
3 Angie 01JAN2015:07:02:12 01JAN2015:08:00:35
湾
ID Name Time1 Time2
2 David 01JAN2015:08:19:27 01JAN2015:09:15:29
3 Mike 01JAN2015:10:58:22 01JAN2015:10:59:21
4 Emily 01JAN2015:08:31:18 01JAN2015:08:53:19
任何人都可以帮忙吗?
答案 0 :(得分:1)
这应该这样做:
proc sql;
create table joined_data as
select * from
a
INNER JOIN
b
on a.x=b.x
where (a.time1 < b.time1 and b.time1 < a.time2 )
or (b.time1 < a.time1 and a.time1 < b.time2 );
quit;