【发布时间】:2012-10-18 17:07:14
【问题描述】:
我想从表 (item2) 和不在 item2 表中的日期向表 (item1) 插入一些值。
如何使用 select 语句编写 SQL 插入语句来实现这一点?
例如:
INSERT into item1(date, name, qty)
values(datevalue, select col1, col2 from item2);
这行不通。我该怎么做才能解决它?
insert into daily_stock(date, product_id, name, weight, qty, free_issues, sales_price,
purchased_price, category, last_purchased_date)
select
**'"+today+"'**,
productId, name, weight, newQty, freeIssues, NewSalesPrice,
NewPurchasePrice, category, datePurchased
from product
我用的是java,今天是一个字符串变量,还是没有插入数据,怎么回事?
【问题讨论】: