insert into table1(num,a,b,c)select distinct(num),a,b,c from table2 where num <>'NULL' 我这样没有去掉重复记录,请高手帮忙试试 SQL code: insert into table1(num,a,b,c)select distinct num,a,b,c from table2 where num is not NULL
insert into table1(num,a,b,c)select distinct(num),a,b,c from table2 where num <>'NULL' 你这样要完全重复才能去掉 而且你的NULL? NUM是字符型吗? 如果不是应该要用NUM IN NOT NULL 只要num字段是完全一样的,我就去重,a,b,c字段不管它.num是字符型 那你A,B,C想保留什么? num,去重后,保留的那一条记录的num,a,b,c字段数据原样插入table1中
这样不得行.还是没有去重,你这样是要整条数据都相同才能去重 那你想保留哪一条呀,随便吗? insert into table1(num,a,b,c)select num,a,b,c from