添加数量时如何在存储过程中不显示负值

时间:2019-01-22 05:09:01

标签: php mysql

我要显示所选表,并使用php中的存储过程添加数量

这是我的代码

DELIMITER $$ CREATE DEFINER=`root`@`localhost` PROCEDURE `GetCustomerLevel`(IN p_barcode INT, OUT q_value INT) BEGIN   
DECLARE q1 int;   DECLARE q2 int;   
DECLARE q3 int;   DECLARE total int;   
SET total :=0;   
SELECT coalesce(sum(adjustment_quantity), 0) INTO q1 FROM adjustment_inventory WHERE item_barcode = p_barcode;   SELECT coalesce(sum(opening_stock), 0) INTO q2 FROM openingstock WHERE item_barcode = p_barcode;   SELECT coalesce(sum(inwardquantity), 0) INTO q3 FROM inwardmaster WHERE item_barcode = p_barcode; set total = q1+q2+q3; set q_value = total; 
END$$ DELIMITER ;

当我调用特定的数据显示但我想显示选择的表时,如果添加数量显示仅正数,而在PHP中显示0而不是负数

0 个答案:

没有答案