试图从mysql中的过程中获取几个值

时间:2012-11-03 12:40:11

标签: mysql procedure

我正在尝试使用这样的程序:

DELIMITER $$

CREATE
    /*[DEFINER = { user | CURRENT_USER }]*/
    PROCEDURE `godating`.`realnames`(OUT rnames VARCHAR)
    /*LANGUAGE SQL
    | [NOT] DETERMINISTIC
    | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
    | SQL SECURITY { DEFINER | INVOKER }
    | COMMENT 'string'*/
    BEGIN
    SELECT username INTO rnames FROM users GROUP BY username HAVING COUNT(*)>3
    END$$

DELIMITER ;

我想在rnames输出中必须有几个username用户名。如何改进我的程序以实现这一目标?

1 个答案:

答案 0 :(得分:0)

DELIMITER $$
CREATE    PROCEDURE `godating`.`realnames`(In rnames varchar)  
    BEGIN
    SELECT username FROM licenses GROUP BY licenses_key having count(*)>0;
    END//

DELIMITER ;
===================
This procedure call like mysql query usind "call sp_name(rnames_values)".