Codigo:
DECLARE @name VARCHAR(255)
DECLARE @item_id INT(10)
DECLARE @quantity INT(10)
DECLARE @suma INT(10)
SET @name = 'nuevo nombre'
SET @item_id = 217
SET @quantity = 300
#contabilizo cuantos registros existen, en caso exista uno se da la condicion
@cont = SELECT count(*) FROM phppos_items WHERE item_id = @item_id
IF @cont <> 0 THEN
#obtengo la cantidad actual y luego la sumo con la nueva
@val1 = SELECT quantity FROM phppos_items WHERE item_id = @item_id
SET @suma = @val1 + @quantity
UPDATE phppos_items SET name=@name, quantity=@suma WHERE item_id=@item_id
END IF
La idea es q corra el codigo en el phpMyAdmin para q ejecute la orden pero me bota el error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET @item_id = 217, SET @quantity = 300, @cont = SELECT count(*) FROM phppos_i' at line 2
Desde ya gracias por la ayuda
