本帖最后由 So_CooL 于 2011-04-21 17:19:15 编辑

解决方案 »

  1.   

    DELIMITER $$
    CREATE PROCEDURE TESTa()
    BEGIN
    DECLARE I INT;
    SET I = 0;
    SELECT COUNT(DB_KEY) INTO I FROM Skr2.mc_config m;
    SELECT I;
    END;$$
    DELIMITER ;
      

  2.   


    delimiter $$
    CREATE PROCEDURE TEST()
    BEGIN
    DECLARE I INT;
    SET I = 0;
    SELECT COUNT(DB_KEY) INTO I FROM Skr2.mc_config m;
    SELECT I;
    END;
    $$
    delimiter ;
      

  3.   

    还是提示错误
    You tried to execute an empty string,please type an sql command into the sql edit 
    fiedl and execte again.
      

  4.   

    我是放在mysql Query Browser可视化操作界面这个工具里面
      

  5.   

    你执行的语句是什么? 贴出来。建议你还是在MYSQL的命令行工具中执行。
      

  6.   

    在mysql工具中执行,为什么执行不了存储过程呢.
    如图:
      

  7.   

    1、在MYSQL命令行下输入;
    2、检查mysql Query Browser中执行所有命令的操作键,比如在SQLYOG中是SHIFT+F9。
      

  8.   

    我这个工具没有命令行呢,命令行在那里呢.
    比如在SQLYOG中是SHIFT+F9。这个是做什么用的,我是第一次用mysql
    多谢指教.
      

  9.   

    是MYSQL的命令行,开始->程序->MYSQL->MYSQL5.1->MYSQL COMMAND LINE CLINT2、检查mysql Query Browser中执行所有命令的操作键,比如在SQLYOG中是SHIFT+F9
      

  10.   

    这个语句那里有错误,
    SELECT
    sum(case when month(time_s) = 1  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 2  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 3  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 4  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 5  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 6  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 7  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 8  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 9  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 10 then time_ms/60.0 else 0),
    sum(case when month(time_s) = 11 then time_ms/60.0 else 0),
    sum(case when month(time_s) = 12 then time_ms/60.0 else 0)
    FROM e_1221463846 E
    LEFT JOIN WEB.WEB_EVENTS_10 W
    ON E.EVENT_TYPE = W.TYPE_ID
    AND E.EVENT_ID = W.EVENT_ID
    WHERE W.TYPE_ID = 2
      

  11.   

    是MYSQL,非MYSQL QUERY,你的MYSQL QUERY能否连接MYSQL?
      

  12.   

    应该是连接了呀.可以看到数据库表.
    我在tools中发现了有一个windows command line的工具了.
    大侠能不能先帮我看看这个Case语句那里有问题,我现在没用存储过程.我是用这个语句来做的.
      

  13.   

    SELECT
    sum(case when month(time_s) = 1  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 2  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 3  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 4  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 5  then time_ms/60.0 else 0),
    sum(case when month(time_s) = 6  then time_ms/60.0 else 0 end ),
    sum(case when month(time_s) = 7  then time_ms/60.0 else 0 end ),
    sum(case when month(time_s) = 8  then time_ms/60.0 else 0 end ),
    sum(case when month(time_s) = 9  then time_ms/60.0 else 0 end ),
    sum(case when month(time_s) = 10 then time_ms/60.0 else 0 end ),
    sum(case when month(time_s) = 11 then time_ms/60.0 else 0 end ),
    sum(case when month(time_s) = 12 then time_ms/60.0 else 0 end )
    FROM e_1221463846 E
    LEFT JOIN WEB.WEB_EVENTS_10 W
    ON E.EVENT_TYPE = W.TYPE_ID
    AND E.EVENT_ID = W.EVENT_ID
    WHERE W.TYPE_ID = 2
      

  14.   

    20楼的是WINDOWS的命令行,非MYSQL的
      

  15.   

    谢谢楼上的各位大侠帮忙,问题解决了,代码如下:
    SELECT
     sum(case when month(time_s) = 1  then time_ms/60 else 0 end),
     sum(case when month(time_s) = 2  then time_ms/60 else 0 end),
     sum(case when month(time_s) = 3  then time_ms/60 else 0 end),
     sum(case when month(time_s) = 4  then time_ms/60 else 0 end),
     sum(case when month(time_s) = 5  then time_ms/60 else 0 end),
     sum(case when month(time_s) = 6  then time_ms/60 else 0 end),
     sum(case when month(time_s) = 7  then time_ms/60 else 0 end),
     sum(case when month(time_s) = 8  then time_ms/60 else 0 end),
     sum(case when month(time_s) = 9  then time_ms/60 else 0 end),
     sum(case when month(time_s) = 10 then time_ms/60 else 0 end),
    sum(case when month(time_s) = 11 then time_ms/60 else 0 end),
    sum(case when month(time_s) = 12 then time_ms/60 else 0 end)
    FROM e_1221463846 E
    LEFT JOIN WEB.WEB_EVENTS_10 W
    ON E.EVENT_TYPE = W.TYPE_ID
    AND E.EVENT_ID = W.EVENT_ID
    WHERE W.TYPE_ID = 2