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

MySQL COUNT SUM

 select
count(*) as mcount ,
left(create_time,10) as ptime ,
count(if(receive_msg is null,id,null)) as nullcount ,
count(if(receive_msg = '1',receive_msg,null)) as apfcount ,
count(if(receive_msg = '2',receive_msg,null)) as dttcount ,
count(if(receive_msg = '3',receive_msg,null)) as dicount
from
t_votes
where
left(create_time,7)>='$pearly'
and
left(create_time,7)<='$plate'
group by
ptime ;

COUNT(*)带上值为NULL的
COUNT(table_name)不带值为NULL的
计数不求和,可用其他字段替代
select
count(*) as mcount ,
left(create_time,10) as ptime ,
SUM(if(receive_msg is null,id,0)) as nullcount ,
SUM(if(receive_msg = '1',receive_msg,0)) as apfcount ,
SUM(if(receive_msg = '2',receive_msg,0)) as dttcount ,
SUM(if(receive_msg = '3',receive_msg,0)) as dicount
from
t_votes
where
left(create_time,7)>='$pearly'
and
left(create_time,7)<='$plate'
group by
ptime ;

SUM求和,最后一个参数改为0.具体原因不明


相关文档:

C# 连接MySql的方法


1.从http://prdownloads.sourceforge.net/mysqldrivercs/MySQLDriverCS-n-EasyQueryTools-3.0.18.exe?download上下载MySQLDriverCS. 
2.把MySQLDriverCS.dll.添加到.net的组件 
3.使用方法 
 下面是创建一个数据库链接:
下面是创建一个数据库链接:
using MySQLDriverCS;
MySQLConnection conn ......

mysql 索引 key 的用法

mysql> desc aa;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id    | int(11) | YES  |     | NULL    |     &n ......

mysql 数据库文件扩展名


格式文件 .frm 描述表的结构(列、列类型、索引,等等)
数据文件 .ISD(ISAM) 或 .MYD (MyISAM) 包含表的数据─即它的行

索引文件 ISD(ISAM) 或 .MYI (MyISAM) 包含数据文件中任何索引的索引树。无论该表有无索引,索引文件都存在
......

mysql 4.1.12


MySQL 4.1.12安装篇
[相关软件下载:]
Mysql 4.1.12-win32 -
For Windows ( Mysql 4.1.12-win32.exe ) -- 数据库服务
下载地址:
http://cdgwbn.downloadsky.com:8080/down/mysql-4.1.12-win32.zip
Connector/ODBC
- MySQL ODBC driver ( MyODBC-3.51.11-1-win.exe ) -- 数据源
下载地址:
http://down.21sun.ne ......

mysql的导入和导出

1、导出
从mysql数据库中导出大量数据,推荐mysqldump 命令,用命令的有点在于比工具灵活,可以通过设置命令的参数来根据条件导出一个表中的部分数据
例如:将一个表的数据按照一定的条件导出到d:\sql1.sql文件中
D:\MySQL5\bin>mysqldump -u用户名 -p密码 --no-create-db=TRUE --no-create-inf
o=TRUE --add-drop-t ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号