注册 登录
编程论坛 MySQL论坛

mysql 问题,找不到原因啊。

BlizzardKen 发布于 2012-04-26 12:00, 1834 次点击
只有本站会员才能查看附件,请 登录
只有本站会员才能查看附件,请 登录

同一个SQL语句用Native Formysql查不出数据,用cmd命令却可以查的出,什么情况?
select   Number as 学号,
sum(case `Subject` when '数学' then Sources end) as '数学',
sum(case `Subject` when '英语' then Sources end) as '英语',
sum(case `Subject` when '语文' then Sources end) as '语文',
sum(case `Subject` when '物理' then Sources END) as '物理',
sum(case `Subject` when '化学' then sources end) as '化学',
sum(case `Subject` when '生物' then sources end) as '生物',
sum(case `Subject` when '政治' then Sources end) as '政治',
sum(case `Subject` when '历史' then Sources end) as '历史',
sum(case `Subject` when '地理' then Sources end) as '地理',
SUM(Sources) as 总分, AVG(Sources) as 平均分
from   test
group   by   Number;

表结构:
CREATE TABLE `test` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Number` int(11) DEFAULT NULL,
  `Subject` char(20) DEFAULT NULL,
  `Sources` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
)
3 回复
#2
AndyLee1682012-05-03 17:09
会不会是配置文件的问题???我也新手
#3
BlizzardKen2012-05-10 19:01
回复 楼主 BlizzardKen
是数据库的编码问题,我自己解决了
#4
shi2787087562012-06-23 10:07
1