Hi,guys.
Now I got two tables which is temp_monthly_sales_stock and con_sales. temp_monthly_sales_stock is a temporary table that I created to store temporary data.
Now the problem is I want to update temp_monthly_sales_stock table by matching the ArtNo from temp_monthly_sales_stock and con_sales table.
But when I execute this query,then nothing. I mean the result shown is "0 row(s) affected".
And I tried this query
this give me an error of "Unknown table 'con_sales' in where clause".
Can someone guide me how to solve this problem?
Now I got two tables which is temp_monthly_sales_stock and con_sales. temp_monthly_sales_stock is a temporary table that I created to store temporary data.
Now the problem is I want to update temp_monthly_sales_stock table by matching the ArtNo from temp_monthly_sales_stock and con_sales table.
But when I execute this query,then nothing. I mean the result shown is "0 row(s) affected".
UPDATE temp_monthly_sales_stock SET Day1=(SELECT SUM(quantity) FROM con_sales WHERE DAY(receiptdate)='2' AND MONTH(receiptdate)='9' AND YEAR(receiptdate)='2012') WHERE EXISTS(SELECT con_sales.ArtNo FROM con_sales WHERE temp_monthly_sales_stock.ArtNo=con_sales.ArtNo)
And I tried this query
UPDATE temp_monthly_sales_stock SET Day1=(SELECT SUM(quantity) FROM con_sales WHERE DAY(receiptdate)='2' AND MONTH(receiptdate)='9' AND YEAR(receiptdate)='2012') WHERE temp_monthly_sales_stock.ArtNo=con_sales.ArtNo
this give me an error of "Unknown table 'con_sales' in where clause".
Can someone guide me how to solve this problem?