返回

mysql-我想使用其他两个 tablw 的子查询插入,但我想按当前日期输入填充日期列

发布时间:2022-06-16 19:37:12 228
# 数据库

我的问题是:

INSERT INTO initial(`name`,`quantity`,`Date`)
select
  c.name AS Item_Name,
  b.Ibyinjiye - i.Ibyasohotse AS Current_Stock_QTY
from product as c
inner join (
  select
    productID,
    ifnull(sum(quantity),0) as Ibyinjiye
  from stockproduct group by productID
) as b on c.productID = b.productID
inner join (
  select productID,
  ifnull(sum(quantity),0) as Ibyasohotse
  from soldstock
  group by productID
) as i on c.productID = i.productID,CURRENT_DATE
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(1)
按点赞数排序
用户头像