Update query failing with error : 1175
I am trying to update a table using the following query
update at_product A join
(
SELECT atbillfields.billeditemguid,count(*) as
numberOfPeopleBought,sum(atbillfields.billeditemqty) As soldquantity
FROM jtbillingtest.at_salesbill atsalesbill join
jtbillingtest.at_billfields atbillfields
on atsalesbill.billbatchguid=atbillfields.billbatchguid
where atsalesbill.billcreationdate BETWEEN'2013-09-09'AND
date_add('2013-09-09', INTERVAL 1 DAY)
group by atbillfields.billeditemguid) B on B.billeditemguid=A.productguid
set A.productQuantity=A.productQuantity-B.soldquantity
but i am getting the following exception
Error Code: 1175. You are using safe update mode and you tried to update a
table without a WHERE that uses a KEY column To disable safe mode, toggle
the option in Preferences -> SQL Queries and reconnect.
When i gave a where clause with update likeA.productQuantity= 1 it updated
that particular . Can someone point why i am unable to execute the query
and how to solve the issue?
No comments:
Post a Comment