I want to insert some values to a table (item1) from a table (item2) and date which is not in that item2 table.
How do I write a SQL insert into statement using the select statement to achieve that?
eg :
INSERT into item1(date, name, qty)
values(datevalue, select col1, col2 from item2);
This isn't working. What should I do to fix it?
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
I'm using java and today is a string variable , still data is not inserting , whats wrong?