insert into p_article_client_detail_current(article_id,sector_detail_id)
select article_id,2818
from ( select article_id from p_article_client_detail_current
where sector_detail_id=239 and convert(varchar(11),feed_date,101) >= '12/07/2012'
)
Msg 102,Level 15,State 1,Line 5 ')'
附近的语法不正确此查询有什么问题,请帮助。
答案 0 :(得分:6)
尝试添加表名(例如T
),如下所示:
insert into p_article_client_detail_current(article_id,sector_detail_id)
select article_id,2818
from ( select article_id from p_article_client_detail_current
where sector_detail_id=239 and convert(varchar(11),feed_date,101) >= '12/07/2012'
) T
如果您不需要嵌套查询,也可以使用此查询:
insert into p_article_client_detail_current(article_id,sector_detail_id)
select article_id,2818
from p_article_client_detail_current
where sector_detail_id=239
and convert(varchar(11),feed_date,101) >= '12/07/2012'
答案 1 :(得分:2)
insert into p_article_client_detail_current(article_id,sector_detail_id)
select article_id,2818 from p_article_client_detail_current
where sector_detail_id=239 and convert(varchar(11),feed_date,101) >= '12/07/2012'
答案 2 :(得分:1)
请为要插入数据的源插入别名。
insert into p_article_client_detail_current(article_id,sector_detail_id)
select article_id,2818
from ( select article_id from p_article_client_detail_current
where sector_detail_id=239 and convert(varchar(11),feed_date,101) >= '12/07/2012'
) as tablealias