回 帖 发 新 帖 刷新版面

主题:请教 Asp查询语句问题

有两个表 A和 B

(都有years字段,A表中的FeedID 和B表中的Logevent表示的是一样的含义)

现在想把 A表中得FeedID=0006045412的years插入到B表的‘years’中

Insert Into B(years) values ('SQL')

想请教大家一下 SQL的内容应该怎么写才正确咯?谢谢咯

----------

附加:insert into B(years) select years from A where FeedId='0006045412'



如果我要插入years ,monthe或者更多的字段 ,SQL语句应该怎么写呀?谢谢咯~~


回复列表 (共5个回复)

沙发


insert into B(years) select years from A where FeedId='0006045412'

板凳

如果是MS-SQL数据库,楼上正解。

3 楼

如果我要插入years ,monthe或者更多的字段 ,SQL语句应该怎么写呀?谢谢咯~~

4 楼


增加相应的字段即可

insert into B(years,monthe) select years,monthe from A where FeedId='0006045412'

5 楼

谢谢。。我回去试试。。回来加分咯THX

我来回复

您尚未登录,请登录后再回复。点此登录或注册