mysql> create table t_user(username varchar(20), gender varchar(20), date dateti
me);
Query OK, 0 rows affected (0.08 sec)
mysql> insert into t_user values('1', '11', '2008-02-01');
Query OK, 1 row affected (0.02 sec)
mysql> insert into t_user values('2', '22', '2008-02-02');
Query OK, 1 row affected (0.00 sec)
mysql> insert into t_user values('1', '33', '2008-02-03');
Query OK, 1 row affected (0.00 sec)
mysql> select * from t_user t where t.date = '2008-02-01' and t.username in (select tt.username from t_user tt where tt.date='2008-02-03');
+----------+--------+---------------------+
| username | gender | date |
+----------+--------+---------------------+
| 1 | 11 | 2008-02-01 00:00:00 |
+----------+--------+---------------------+
1 row in set (0.03 sec)