易截截图软件、单文件、免安装、纯绿色、仅160KB

mysql 一道小题

 表名为table的表内容如下
Year month value
2009  1    1.1
2009  2    1.2
2009  3    1.3
2009  4    1.4
2010  1    2.1
2010  2    2.2
2010  3    2.3
2010  4    2.4
要求查询结果为
year  m1  m2  m3  m4
2009  1.1  1.2  1.3  1.4
2010  2.1  2.2  2.3  2.4
mysql> select year,sum(case when month=1 then value end) as 'm1',sum(case when m
onth=2 then value end) as 'm2',sum(case when month=3 then value end)as 'm3' from
 table2 group by year;


相关文档:

Mysql编译安装参数优化

 1. -static  13%
   --with-client-ldflags=-all-static
   --with-mysqld-ldflags=-all-static
静态链接提高13%性能
2. -pgcc  1%
   CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
     CXXFLAGS="-O3 -mpentiumpro -mstack-alig ......

MySQL: Connect MySQL GUI tools to WAMP 2.0

Connect MySQL GUI tools to WAMP 2.0 Posted by: Vladislav Sadykov () Date: January 24, 2009 09:31AM Hay, I have a problem with MySQL database. I have installed WAMP 2.0 server on my Windows machine and now I would like to connect it with MySQL GUI tools 5. The problem is that at the startup of ......

Linux下分析Mysql日志的好工具–mysqlsla


从http://hackmysql.com/mysqlsla下载mysqlsla,当前最新版为:2.03
tar zxvf mysqlsla-2.03.tar.gz
cp mysqlsla-2.03/bin/mysqlsla /usr/local/bin
如果提示“Can’t locate DBI.pm”,执行以下命令
yum install perl-DBI perl-DBD-MySQL -y
这时就可以使用mysqlsla了,用法如下
mysqlsla -lt slo ......

mysql set names 问题

mysql set names 问题
mysql_query("set names 'utf8'");
一直以来总以为set names 是用来设置msyql 的字符集的,最近作个东西才发现自己认识上的错误,
查一下手册
SET NAMES ‘x‘语句与这三个语句等价:
mysql> SET character_set_client = x;
mysql> SET character_set_results = x;
mysql> ......

MySQL MyIsam 存储引擎索引长度限制测试记录

MySQL MyIsam 存储引擎在创建索引的时候,索引键长度是有一个较为严格的长度限制的,所有索引键最大长度总和不能超过1000,而且不是实际数据长度的总和,而是索引键字段定义长度的总和。下面做个简单的测试,记录一下。
root@sky:~# mysql -u sky -p -h127.0.0.1
Enter password:
Welcome to the MySQL monitor. Command ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号