楼主: ertyuj
1162 3

sql出来的结果和预期不同:请给把把脉吧 [推广有奖]

  • 0关注
  • 1粉丝

已卖:7份资源

硕士生

40%

还不是VIP/贵宾

-

威望
0
论坛币
254 个
通用积分
0.7615
学术水平
0 点
热心指数
1 点
信用等级
0 点
经验
-351 点
帖子
136
精华
0
在线时间
164 小时
注册时间
2007-2-7
最后登录
2022-3-17

楼主
ertyuj 发表于 2014-12-19 13:23:46 |AI写论文
15论坛币
现在我有一个基准文件t,需要使用left join把一些代码(在括号内)生成的数据合到我的这个基准文件上。我能用下边这段代码吗?

select t.* from t left join (括号内的代码是已给的:
select a.*, b.*, c.*, d.*, e.* from a,b, c left join d on c.idc=d.idd
         left join e on c.idc=e.ide
         left join f on c.idc=f.idf
         where a.id=b.idb and a.id=c.idc) all on t.idt = all.id


如果里边有错,能给改改、讲讲吗?谢谢。

关键词:sql left join Select Elect Where create
数据科学和机器学习博客:https://shorturl.at/jtHTW

沙发
pobel 在职认证  发表于 2014-12-19 13:38:04
你没有SELECT 数据集b里的变量,当然合不上去

藤椅
ertyuj 发表于 2014-12-19 13:56:11
pobel 发表于 2014-12-19 13:38
你没有SELECT 数据集b里的变量,当然合不上去
我这里有select文件b里的变量啊,你看:(select name as bname, hght as bhght from b) 。能给改改code吗?

板凳
pobel 在职认证  发表于 2014-12-22 17:48:13
ertyuj 发表于 2014-12-19 13:56
我这里有select文件b里的变量啊,你看:(select name as bname, hght as bhght from b) 。能给改改code吗 ...
Proc SQL
   create table a as
     select l.variables,r.variables from ();
quit;

这里,所create的数据集A,只会包含SELECT里指定的l.variables 和r.variables

至于括号里的表的连接里提到的其他变量,不会被包含在a里

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-3 14:16