can someone help me with this query?
the first case works it does update the punchval field if punchval < 10 then it deducts 11 from punchval, but i can't seem to get it to work when punchval is >=0. it should take punchval + (-10) to punchval field. please help...this is the first time i've used case in my update statement.Code:UPDATE punch SET punchval = CASE WHEN punchval > 10 THEN punchval - 11 WHEN punchval <= 0 THEN punchval +(-10) ELSE punchval END WHERE pc = $WASHES_ROW[pc] AND EXISTS ( SELECT * FROM tvalues JOIN lookups ON lookups.ttype = tvalues.ttype WHERE tvalues.transid2 = $WASHES_ROW[transid] AND lookups.ttype IN ('4980','4981') ) ";








Bookmarks