INSERT INTO T_Temp
? ([year], [month], ProdCode, ChnCountryId,ie)
SELECT '2008', '12', T_HS.ProdCode,?
? T_Country.chncountryid,T_IE.ie
FROM T_HS CROSS JOIN
? T_Country CROSS JOIN
? T_IE
如上面的sql,我想将年月的信息固定(2008年12月),很显然是不能写到select里的,而其他三个参数的信息又需要从select里获得,求高人帮忙改下sql,怎么写才是对的呢?
------解决方案--------------------
- SQL code
[code=SQL]INSERT INTO T_Temp ([year], [month], ProdCode, ChnCountryId,ie)SELECT [year]='2008',[month]= '12', T_HS.ProdCode, T_Country.chncountryid,T_IE.ieFROM T_HS CROSS JOIN T_Country CROSS JOIN T_IE
------解决方案--------------------
你的写法没有错.
- SQL code
INSERT INTO T_Temp([year], [month], ProdCode, ChnCountryId , ie)SELECT '2008', '12', T_HS.ProdCode, T_Country.chncountryid,T_IE.ieFROM T_HS CROSS JOIN T_Country CROSS JOIN T_IE