解决方案 »
- mysql,30G二进制文件的数据恢复,真心求教
- 求助一个查询语句,关于ENUM类型
- mysql 排序问题
- 如何将两个字段不一样的表合为一个表?
- PostgreSQL及EnterpriseDB发起人Bruce Momjian中国技术交流会
- 急,改错
- Communications link failure due to underlying exception:
- mysql连接的用户问题!!!!!
- 求一个高效的树型结构的实现方式。(包括数据结构和算法)如果解决有1000分想送!!!!
- 如何在vc6.0使用mysql,就是怎么在c语言中使用
- MYSQL事务回滚的问题
- MySQL中Max查最大值的用法
+--------+------+
| userid | name |
+--------+------+
| 1 | abc |
| 2 | cde |
| 3 | hig |
| 4 | lim |
+--------+------+
4 rows in set (0.00 sec)mysql> select * from b;
+----+------------+
| id | time |
+----+------------+
| 1 | 2009-01-02 |
| 1 | 2009-01-02 |
| 1 | 2009-03-01 |
| 2 | 2009-01-02 |
| 2 | 2009-03-05 |
+----+------------+
5 rows in set (0.00 sec)mysql> select a.userid,count(b.time) as counter from a left join b on a.userid=b.id and b.time='2009-01-02' group by a.userid;
+--------+---------+
| userid | counter |
+--------+---------+
| 1 | 2 |
| 2 | 1 |
| 3 | 0 |
| 4 | 0 |
+--------+---------+
4 rows in set (0.01 sec)