Saturday, 15 August 2015

if statement - Mysql Updating with if condition within a Table -



if statement - Mysql Updating with if condition within a Table -

i unable update 2 fields in table using udpate , if condition. need help.

i have invoice table in if field nos=0 need update field qty capacity , field nos=1 in same table.

my sql statement not working:

update invdtls_draft1 set `nos`=1, `qty`=`capacity` if (nos=0) id=id

error message:

#1064 - have error in sql syntax; check manual corresponds mysql server version right syntax utilize near 'if (nos=0) id=id' @ line 1

try query, using and operator

update invdtls_draft1 set `nos`=1, `qty`=`capacity` id=id , nos=0

mysql if-statement sql-update

No comments:

Post a Comment