新手请教insert into问题。
<p>一个较复杂的SQL语句想用INSERT INTO到一个新表,可总提示错误。SQL语句如下,请大侠检查一下。</p><p>insert into spf_thyj1(f_id,<br/> f_isbn,<br/> f_sm,<br/> f_dj,<br/> f_scdhrq,<br/> f_zhdhrq,<br/> f_zdhcs,<br/> thdate,<br/> kc,<br/> zxs,<br/> bl,<br/> gzmc)</p><p>select sa.f_id,<br/> f_isbn,<br/> f_sm,<br/> sa.f_dj,<br/> f_scdhrq,<br/> f_zhdhrq,<br/> f_zdhcs,<br/> datediff(day,f_scdhrq,getdate()),<br/> sum(F_KFCS),<br/> zxs,<br/> sum(F_KFCS)/f_zdhcs,<br/>case when F_GZJP='SE' then '少儿'<br/> when F_GZJP='YX' then '音像'<br/> when F_GZJP='KJ' then '科技'<br/> when F_GZJP='JY' then '教育'<br/> when F_GZJP='SK' then '社科'<br/> end as jp<br/> from spf_view_dhmx as sa,BMKC,SMK,SPFGZ,spf_xsph<br/> where sa.f_id=BMKC.F_ID<br/> and F_KFCS>0<br/> and sa.f_id=SMK.F_ID<br/> and SMK.F_FLBH=SPFGZ.F_FLBH<br/> and sa.f_id*=spf_xsph.f_id<br/> and datediff(day,f_scdhrq,getdate())>150<br/>group by sa.f_id,SPFGZ.F_FLBH,F_GZJP,spf_xsph.f_id<br/><br/>;</p>
页:
[1]