insert into t_stock_inventory_product (ipid,inventoryid,sortname1,sortname2,sortname3,productid,productno,product,stockcount)
values (1,2
(select t1.sortname as sortname1,t2.sortname as sortname2,t3.sortname as sortname3,t4.productid as productid,t4.productno as productno,t4.product as product ,t7.stockcount as stockcount
from t_manufacture_sort as t1,t_manufacture_sort as t2,t_manufacture_sort as t3,t_manufacture_archive as t4
right join (select t6.productid,x.stockcount from t_stock_collocate as t6
join (select t5.collid,sum(t5.factamount) as stockcount from t_stock_collocate_details as t5 group by (t5.collid)) as x on (x.collid = t6.collid)) as t7 on (t7.productid = t4.productid)
where t4.organid1 = t1.sortid and t4.organid2 = t2.sortid and t4.organid3 = t3.sortid))是MYSQL的。然后执行总报错. 后面括号里的查询都能查吃来的。
加上INSERT INTO 就不行了。
大家帮我看看。
我新注册的 不怎么有分。
以后有机会加分啦.
谢谢。
还有不要问我为什么这么多表关联(没办法,,做设计的人就设计了这么多表 只有关联这么多才能取到数据);
values (1,2
(select t1.sortname as sortname1,t2.sortname as sortname2,t3.sortname as sortname3,t4.productid as productid,t4.productno as productno,t4.product as product ,t7.stockcount as stockcount
from t_manufacture_sort as t1,t_manufacture_sort as t2,t_manufacture_sort as t3,t_manufacture_archive as t4
right join (select t6.productid,x.stockcount from t_stock_collocate as t6
join (select t5.collid,sum(t5.factamount) as stockcount from t_stock_collocate_details as t5 group by (t5.collid)) as x on (x.collid = t6.collid)) as t7 on (t7.productid = t4.productid)
where t4.organid1 = t1.sortid and t4.organid2 = t2.sortid and t4.organid3 = t3.sortid))是MYSQL的。然后执行总报错. 后面括号里的查询都能查吃来的。
加上INSERT INTO 就不行了。
大家帮我看看。
我新注册的 不怎么有分。
以后有机会加分啦.
谢谢。
还有不要问我为什么这么多表关联(没办法,,做设计的人就设计了这么多表 只有关联这么多才能取到数据);
解决方案 »
- ODI执行接口时报错Insert flow into I$ table
- 连接建立后等待7200秒客户端与服务器发送什么数据包?
- 请教一句SQL,谢谢
- sql语句查询
- oracle goldengate 求助
- 高分求助
- select code from tb where tb.time >(select max(tb2.time) from tb2 where tb2.code = tb1.code),要求如tb2中纪录中没有对应的code,则
- 哪有oracle procedure builder 可以下载
- oracle中连接两个字符串是怎么写的?
- odac部署问题:请大神赐教如何部署,部署在服务器上还是客户端上
- 在oracle中求一trigger
- ora-12519 远程在linux上新建立oracle 9i的监听应用
肯定报错
(ipid, inventoryid, sortname1, sortname2, sortname3, productid,
productno, product, stockcount)
SELECT 1, 2, t1.sortname AS sortname1, t2.sortname AS sortname2,
t3.sortname AS sortname3, t4.productid AS productid,
t4.productno AS productno, t4.product AS product,
t7.stockcount AS stockcount
FROM t_manufacture_sort t1,
t_manufacture_sort t2,
t_manufacture_sort t3,
t_manufacture_archive t4
RIGHT JOIN
(SELECT t6.productid, x.stockcount
FROM t_stock_collocate t6
JOIN
(SELECT t5.collid, SUM (t5.factamount) AS stockcount
FROM t_stock_collocate_details t5
GROUP BY (t5.collid)) x ON (x.collid = t6.collid)
) t7 ON (t7.productid = t4.productid)
WHERE t4.organid1 = t1.sortid
AND t4.organid2 = t2.sortid
AND t4.organid3 = t3.sortid你改成这样看看,前面没看到你1,2两个数据
另外oracle里表名后面不能用as的,所以我把表名后面的AS全去掉了,不知道mysql是否支持这样