mysql简单问题集

So_CooL 2011-04-21 05:18:27
CREATE PROCEDURE TEST()
BEGIN
DECLARE I INT;
SET I = 0;
SELECT COUNT(DB_KEY) INTO I FROM Skr2.mc_config m;
SELECT I;
END;
这样写那里有错误.
...全文
797 24 打赏 收藏 转发到动态 举报
写回复
用AI写文章
24 条回复
切换为时间正序
请发表友善的回复…
发表回复
So_CooL 2011-04-22
  • 打赏
  • 举报
回复


谢谢楼上的各位大侠帮忙,问题解决了,代码如下:
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
WWWWA 2011-04-22
  • 打赏
  • 举报
回复
20楼的是WINDOWS的命令行,非MYSQL的
WWWWA 2011-04-22
  • 打赏
  • 举报
回复
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
ACMAIN_CHM 2011-04-22
  • 打赏
  • 举报
回复
[Quote]大侠能不能先帮我看看这个Case语句那里有问题,我现在没用存储过程.我是用这个语句来做的.[/Quote]添出你的执行结果和错误信息。

问题说明越详细,回答也会越准确!参见如何提问。(提问的智慧
So_CooL 2011-04-22
  • 打赏
  • 举报
回复
应该是连接了呀.可以看到数据库表.
我在tools中发现了有一个windows command line的工具了.
大侠能不能先帮我看看这个Case语句那里有问题,我现在没用存储过程.我是用这个语句来做的.


WWWWA 2011-04-22
  • 打赏
  • 举报
回复
是MYSQL,非MYSQL QUERY,你的MYSQL QUERY能否连接MYSQL?
So_CooL 2011-04-22
  • 打赏
  • 举报
回复
好象是1.2.17 可能是5.0吧.
WWWWA 2011-04-22
  • 打赏
  • 举报
回复
你的MYSQL什么版本?
So_CooL 2011-04-22
  • 打赏
  • 举报
回复
为什么我的没有你们说的这个选项呢
难道我的版本装错了.


So_CooL 2011-04-22
  • 打赏
  • 举报
回复
这个语句那里有错误,
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
WWWWA 2011-04-22
  • 打赏
  • 举报
回复
是MYSQL的命令行,开始->程序->MYSQL->MYSQL5.1->MYSQL COMMAND LINE CLINT

2、检查mysql Query Browser中执行所有命令的操作键,比如在SQLYOG中是SHIFT+F9
So_CooL 2011-04-22
  • 打赏
  • 举报
回复
我这个工具没有命令行呢,命令行在那里呢.
比如在SQLYOG中是SHIFT+F9。这个是做什么用的,我是第一次用mysql
多谢指教.
WWWWA 2011-04-22
  • 打赏
  • 举报
回复
1、在MYSQL命令行下输入;
2、检查mysql Query Browser中执行所有命令的操作键,比如在SQLYOG中是SHIFT+F9。
So_CooL 2011-04-22
  • 打赏
  • 举报
回复
在mysql工具中执行,为什么执行不了存储过程呢.
如图:
ACMAIN_CHM 2011-04-21
  • 打赏
  • 举报
回复
你执行的语句是什么? 贴出来。

建议你还是在MYSQL的命令行工具中执行。
So_CooL 2011-04-21
  • 打赏
  • 举报
回复
错误图片如下:
So_CooL 2011-04-21
  • 打赏
  • 举报
回复
mySql查询工具:
So_CooL 2011-04-21
  • 打赏
  • 举报
回复
我是放在mysql Query Browser可视化操作界面这个工具里面
rucypli 2011-04-21
  • 打赏
  • 举报
回复
报的什么错误
WWWWA 2011-04-21
  • 打赏
  • 举报
回复
你的代码是什么
加载更多回复(4)

56,687

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧