insert into tablex (a,b,c)
select distinct a,b,c
from tableA;
当我单独运行 select distinct 语句时,它显示 6 行。当我使用 insert 运行时,它显示 0 rows inserted 。
是错误还是我错过了一些东西。
#Teradata 13.10
屏蔽原始查询
INSERT INTO tablex
(SYSTEM_ID,START_DATE,END_DATE,CURRENT_FLAG )
SELECT DISTINCT
,s.SYSTEM_ID
,s.trans_DATE
,DATE '9999-12-31'
,'X'
FROM s JOIN cc
ON s.var_id=cc.var_id
WHERE s.sno = cc.sno
AND s.sno<>s.orino AND s.orino IS NOT NULL AND s.orino <> ''
AND cc.end_date=s.trans_date-1;