【sas sql proc】inner join or outer join

 1 proc sql;
 2     title 'table 1+11';
 3     select * from mysas.ifthen1,mysas.ifthen11;
 4 quit;
 5 
 6 proc sql;
 7     title 'table 1';
 8     select * from mysas.ifthen1;
 9     
10     title 'table11';
11     select * from mysas.ifthen11;
12 quit;

第一段显示的是两表联合的笛卡尔积结果。

第二段仅是分别显示两表。

 

 1 proc sql;
 2     title 'table1 inner jion table11';
 3     select a.gtone as g from mysas.ifthen1 a,mysas.ifthen11 b
 4     where a.gtone=b.gtone;
 5 quit;
 6 proc sql;
 7     title 'table1 inner jion table11';
 8     select a.gtone  'g' from mysas.ifthen1 a,mysas.ifthen11 b
 9     where a.gtone=b.gtone;
10 quit;

行的别名,两种方式一种是标签,另一种是另起名。

 from where 和inner join +on的作用一致 inner join +on是为了和left/right join on 相统一。

1 proc sql;
2     title 'self join';
3     select a.gtone,b.shen
4     from mysas.ifthen1 a,mysas.ifthen1 b
5     where a.date=b.date;
6 quit;

用别名可以实现自身与自身的查询。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值