i'm trying update fields using below query. error in below query ?
mysql said: documentation
1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'from orders cl' @ line 2
update hedging set dept = concat(right( dpt.deptname,2),left( grp.groupname,3),left( st.login,3)), orderno = cl.orderno,client = cn.shortname, currency = cur.notation, sellingamount = pto.piamount , buyingamount = pto.poamount orders cl left join client cn on cl.clientid = cn.clientid inner join department dpt on cl.deptid = dpt.deptid inner join supplier sp on cl.supplierid = sp.supplierid left join staff st on st.staffid = cl.salesperson left join pipo_total pto on pto.orderno = cl.orderno inner join groups grp on cl.groupid = grp.groupid left join currency cur on cur.currencyid= cl.sellcurrencyid left join hedging hed on hed.orderno = cl.orderno) cur.notation <> 'usd' , cl.ordertype = '1' , hed.orderno = cl.orderno
try 1
update orders cl left join client cn on cl.clientid = cn.clientid inner join department dpt on cl.deptid = dpt.deptid inner join supplier sp on cl.supplierid = sp.supplierid left join staff st on st.staffid = cl.salesperson left join pipo_total pto on pto.orderno = cl.orderno inner join groups grp on cl.groupid = grp.groupid left join currency cur on cur.currencyid= cl.sellcurrencyid left join hedging hed on hed.orderno = cl.orderno set hed.dept = concat(right( dpt.deptname,2),left( grp.groupname,3),left( st.login,3)) ,hed.orderno = cl.orderno ,hed.client = cn.shortname ,hed.currency = cur.notation ,hed.sellingamount = pto.piamount ,hed.buyingamount = pto.poamount cur.notation <> 'usd' , cl.ordertype = '1' , hed.orderno = cl.orderno
update
multiple tables should this
update table1 t1 inner join table2 t2 on t1.id = t2.id set t1.value = [value]
edit: updated query
update orders cl left join client cn on cl.clientid = cn.clientid inner join department dpt on cl.deptid = dpt.deptid inner join supplier sp on cl.supplierid = sp.supplierid left join staff st on st.staffid = cl.salesperson left join pipo_total pto on pto.orderno = cl.orderno inner join groups grp on cl.groupid = grp.groupid left join currency cur on cur.currencyid= cl.sellcurrencyid left join hedging hed on hed.orderno = cl.orderno) set dept = concat(right( dpt.deptname,2),left( grp.groupname,3),left( st.login,3)) ,orderno = cl.orderno ,client = cn.shortname ,currency = cur.notation ,sellingamount = pto.piamount ,buyingamount = pto.poamount cur.notation <> 'usd' , cl.ordertype = '1' , hed.orderno = cl.orderno
Comments
Post a Comment