易截截图软件、单文件、免安装、纯绿色、仅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的中文乱码问题

 这段时间被这个困扰了很久,通过修改配置文件,终于把这个问题解决了。
自己在网上也找了很多关于解决这个问题的方法,但是都讲的不太清楚,所以今天在这重新说下这个问题。
我的解决方法是通过修改mysql的配置文件my.ini,方法如下:
在my.ini中可以发现有这么一段代码:
[client]
port=3306
[mysql]
default ......

mysql报错

报错:
 /tmp/ccBBJEB8.o: In function `ping_sql':
pingsql.c:(.text+0x7c): undefined reference to `mysql_init'
pingsql.c:(.text+0xe1): undefined reference to `mysql_real_connect'
pingsql.c:(.text+0xff): undefined reference to `mysql_close'
pingsql.c:(.text+0x119): undefined reference to `mys ......

介绍mysql数据库下show命令的主要用法


  
  本文主要介绍mysql数据库下show命令的主要用法:
  a. show tables或show tables from database_name; -- 显示当前数据库中所有表的名称。
  b. show databases; -- 显示mysql中所有数据库的名称。
  c. show columns from table_name from database_name; 或show columns from database_name.table_n ......

MySQL里建立索引应该考虑数据库引擎的类型

 前一直没注意这一点,突然一闪念想起来,下面唠唠:
比方说有一个文章表,我们要实现某个类别下按时间倒序列表显示功能:
SELECT * from articles WHERE category_id = … ORDER BY created DESC LIMIT …
这样的查询很常见,基本上不管什么应用里都能找出一大把类似的SQL来,学院派的读者看到上面的S ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号