mysql procedure

Posted Dothraki

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql procedure相关的知识,希望对你有一定的参考价值。

DELIMITER //
  CREATE PROCEDURE in_param(IN motherfuckerA VARCHAR(31),IN motherfuckerB VARCHAR(31))
    BEGIN
    SELECT a.bid,SUM(a.signingNumber),SUM(a.testNumber) FROM 
    (
            SELECT ce.bid,COUNT(ce.cid) signingNumber,NULL testNumber FROM
            (
                SELECT b.id bid,cus.id cid,cus.creat_time,cus.large_area_code FROM  
                    (
                        SELECT c.id,c.creat_time,c.large_area_code,c.accendant_id FROM customer c  WHERE c.`status` = SUCCESS AND c.account_type = SIGNING 
                    ) cus 
                RIGHT JOIN sys_emplyee b ON cus.accendant_id = b.id
                WHERE cus.large_area_code IN (motherfuckerA)
            ) ce GROUP BY ce.bid
    UNION ALL
    
            SELECT ce.bid,NULL signingNumber, COUNT(ce.cid) testNumber FROM 
            (
                SELECT b.id bid,cus.id cid,cus.creat_time,cus.large_area_code FROM  
                (
                    SELECT c.id,c.creat_time,c.large_area_code,c.accendant_id FROM customer c WHERE c.`status` = SUCCESS AND c.account_type = TEST 
                ) cus
                RIGHT JOIN sys_emplyee b ON  cus.accendant_id = b.id
                WHERE cus.large_area_code IN (motherfuckerB)
            ) ce 
            GROUP BY ce.bid
    ) a GROUP BY a.bid;
    END;
    //
DELIMITER ;
    
SET @motherfuckerA=southwestRegion;
SET @motherfuckerB=southRegion;
CALL in_param(@motherfuckerA,@motherfuckerB)

 

以上是关于mysql procedure的主要内容,如果未能解决你的问题,请参考以下文章

mysql store procedure 存储过程

Home / Python MySQL Tutorial / Calling MySQL Stored Procedures in Python Calling MySQL Stored Proced

MySQL存储过程(PROCEDURE)

详解MYSQL中重命名procedure的一种方法

mysql procedure

MySQL:procedure, function, cursor,handler