Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
371 views
in Technique[技术] by (71.8m points)

有啥办法把EG1、 EG2、 EG3 这些字段,都合并到一个EG字段

一个表有ID、EG1、EG3、EG3共4个字段,想变成ID、EG2个字段,使得行数变成原来三倍,列数从4列变成2列,请问在DolphinDB有什么办法?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
t=table(1 as id,1.0 as EG1,2.0 as EG2,3.0 as EG3)
t1=select id,EG1 as EG from t
t2=select id,EG2 as EG from t
t3=select id,EG3 as EG from t
unionAll([t1,t2,t3],false)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...