Working with two tables.customercus_no uf1 908 903 901 910
order1cus_no inv_dt tot_sls_amt 908 10/3/2010 1000.00 908 10/4/2010 500.00 903 10/14/2010 300.00 901 10/20/2010 400.00 901 10/23/2010 400.00 901 10/13/2010 400.00
What I'm trying to accomplish is adding the tot_sls_amt and updating uf1 in the customer table.customercus_no uf1 908 1500.00 903 300.00 901 1200.00 910 0.00
Here is what I've tried. Get incorrect syntax near keyword whereupdate customerset customer.uf1 = (select tot_sls_amt1from(select cus_no,sum(tot_sls_amt)as total_sls_amt1 from order1group by cus_no)where order1.cus_no = customer.cus_no and month(order1.inv_dt) = month(getdate()) and year(order1.inv_dt)=year(getdate()))from order1 join customer on order1.cus_no = customer.cus_no