a表部分字段复制到b表
各位老师好!我想将a表的部分字段复制到b表,2个表有相同的字段,也有不相同的字段。需要复制的是相同字段的一部分,不是全部相同的字段。不相同的字段不复制。
用了以下方法:
COPY TO 复制个数1 FIELDS LIKE qihao,h1,h2,h3,h1s1,h1s2,h1s3,h1s4,h1s5,h1s6,h1s7,h1s8......(共49个字段)结果是b表不相同的字段都没有了;
insert into 复制个数1(qihao,h1,h2,h3,;
h1s1,h1s2,h1s3,h1s4,h1s5,h1s6,h1s7,h1s8,h1s9,h1s10,h1s11,h1s12,h1s13,h1s14,h1s15,;
h2s1,h2s2,h2s3,h2s4,h2s5,h2s6,h2s7,h2s8,h2s9,h2s10,h2s11,h2s13,h2s13,h2s14,h2s15,;
h3s1,h3s2,h3s3,h3s4,h3s5,h3s6,h3s7,h3s8,h3s8,h3s10,h3s11,h3s12,h3s13,h3s14,h3s15,;
select qihao,h1,h2,h3,h1s1,h1s2,h1s3,h1s4,h1s5,h1s6,h1s7,h1s8,h1s9,h1s10,h1s11,h1s12,h1s13,h1s14,h1s15,;
h2s1,h2s2,h2s3,h2s4,h2s5,h2s6,h2s7,h2s8,h2s9,h2s10,h2s11,h2s12,h2s13,h2s14,h2s15,;
h3s1,h3s2,h3s3,h3s4,h3s5,h3s6,h3s7,h3s8,h3s9,h3s10,h3s11,h3s12,h3s13,h3s14,h3s15;
FROM 分列统计15期 CLEAR
结果是select后面的语句太长,VF死机。
COPY TO ARRAY sz1 FIELDS like qihao,h1,h2,h3,;
h1s1,h1s2,h1s3,h1s4,h1s5,h1s6,h1s7,h1s8,h1s9,h1s10,h1s11,h1s12,h1s13,h1s14,h1s15,;
h2s1,h2s2,h2s3,h2s4,h2s5,h2s6,h2s7,h2s8,h2s9,h2s10,h2s11,h2s12,h2s13,h2s14,h2s15,;
h3s1,h3s2,h3s3,h3s4,h3s5,h3s6,h3s7,h3s8,h3s8,h3s10,h3s11,h3s12,h3s13,h3s14,h3s15;
all
运行没有问题,但不知道是否将49个字段的记录都复制到数组。
SELECT 复制个数1
append FROM ARRAY sz1 FIELDS qihao,h1,h2,h3,;
h1s1,h1s2,h1s3,h1s4,h1s5,h1s6,h1s7,h1s8,h1s9,h1s10,h1s11,h1s12,h1s13,h1s14,h1s15,;
h2s1,h2s2,h2s3,h2s4,h2s5,h2s6,h2s7,h2s8,h2s9,h2s10,h2s11,h2s12,h2s13,h2s14,h2s15,;
h3s1,h3s2,h3s3,h3s4,h3s5,h3s6,h3s7,h3s8,h3s8,h3s10,h3s11,h3s12,h3s13,h3s14,h3s15
运行结果是找不到sz1.
第四种方法:
scatter FIELDS qihao,h1,h2,h3,;
h1s1,h1s2,h1s3,h1s4,h1s5,h1s6,h1s7,h1s8,h1s9,h1s10,h1s11,h1s12,h1s13,h1s14,h1s15,;
h2s1,h2s2,h2s3,h2s4,h2s5,h2s6,h2s7,h2s8,h2s9,h2s10,h2s11,h2s12,h2s13,h2s14,h2s15,;
h3s1,h3s2,h3s3,h3s4,h3s5,h3s6,h3s7,h3s8,h3s8,h3s10,h3s11,h3s12,h3s13,h3s14,h3s15;
to sz1
运行没有问题
gather from sz1 FIELDS qihao,h1,h2,h3,;
h1s1,h1s2,h1s3,h1s4,h1s5,h1s6,h1s7,h1s8,h1s9,h1s10,h1s11,h1s12,h1s13,h1s14,h1s15,;
h2s1,h2s2,h2s3,h2s4,h2s5,h2s6,h2s7,h2s8,h2s9,h2s10,h2s11,h2s12,h2s13,h2s14,h2s15,;
h3s1,h3s2,h3s3,h3s4,h3s5,h3s6,h3s7,h3s8,h3s8,h3s10,h3s11,h3s12,h3s13,h3s14,h3s15
运行后提示找不到sz1
请各位老师帮助指导。谢谢。
表a.zip
(607.67 KB)
表b.zip
(539 Bytes)