猿问

MYSQL数据库,inser into select where 语句

MYSQL 数据库,同一个数据库中有两个表 news和article,现在我想把表article中的字段 title content zznews nfrom hits dateandtime editor 内的值赋值给表news中的字段 title content author source hits sendtime keywords,SQL语句该怎么写?
我之前像下面那么写的,出错,请高手来解答!
insert into news(Title,Content,Author,Source,Hits,Sendtime,Keywords) values select title,content,zznews,nfrom,hits,dateandtime,editor from article where tjnews=0 and typeid=8

眼眸繁星
浏览 665回答 2
2回答

弑天下

你的字段都没搞出来,怎么啊,我假如你只有三个字段,一个ID,一个column1,column2吧:Delete From tablewhere ID not in (Select min(iD) From Table group by column1,column2)--有多少个字段,group by 后面加多少个,ID除外

开满天机

insert into news(Title,Content,Author,Source,Hits,Sendtime,Keywords) select title,content,zznews,nfrom,hits,dateandtime,editor from article where tjnews=0 and typeid=8
随时随地看视频慕课网APP

相关分类

MySQL
我要回答