UPDATE: Using SQL Server:
CREATE TABLE t1 (id int IDENTITY PRIMARY KEY, name varchar(20), date datetime);
INSERT INTO t1 VALUES('John', '2010-03-27 18:17:00');
INSERT INTO t1 VALUES('Mike', '2010-03-27 16:38:00');
INSERT INTO t1 VALUES('Sonny', '2010-03-28 20:23:00');
INSERT INTO t1 VALUES('Anna', '2010-03-29 13:51:00');
INSERT INTO t1 VALUES('Maria', '2010-03-29 21:59:00');
INSERT INTO t1 VALUES('Penny', '2010-03-29 17:25:00');
INSERT INTO t1 VALUES('Alba', '2010-03-30 09:36:00');
INSERT INTO t1 VALUES('Huston', '2010-03-31 10:19:00');
SELECT t1.id, t1.name, sub_t.date
FROM t1
JOIN (SELECT DATEADD(dd, DATEDIFF(dd,0, date), 0) as date
FROM t1
GROUP BY DATEADD(dd, DATEDIFF(dd,0, date), 0)
HAVING COUNT(id) > 1) sub_t ON
(sub_t.date = DATEADD(dd, DATEDIFF(dd,0, t1.date), 0));
Returns:
+----+-------+---------------------+
| id | name | date |
+----+-------+---------------------+
| 1 | John | 2010-03-27 00:00:00 |
| 2 | Mike | 2010-03-27 00:00:00 |
| 4 | Anna | 2010-03-29 00:00:00 |
| 5 | Maria | 2010-03-29 00:00:00 |
| 6 | Penny | 2010-03-29 00:00:00 |
+----+-------+---------------------+
Previous answer assumed MySQL:
Joining with a sub query would be one option:
CREATE TABLE t1 (id int AUTO_INCREMENT PRIMARY KEY,
name varchar(20),
date datetime);
INSERT INTO t1 VALUES(NULL, 'John', '2010-03-27 18:17:00');
INSERT INTO t1 VALUES(NULL, 'Mike', '2010-03-27 16:38:00');
INSERT INTO t1 VALUES(NULL, 'Sonny', '2010-03-28 20:23:00');
INSERT INTO t1 VALUES(NULL, 'Anna', '2010-03-29 13:51:00');
INSERT INTO t1 VALUES(NULL, 'Maria', '2010-03-29 21:59:00');
INSERT INTO t1 VALUES(NULL, 'Penny', '2010-03-29 17:25:00');
INSERT INTO t1 VALUES(NULL, 'Alba', '2010-03-30 09:36:00');
INSERT INTO t1 VALUES(NULL, 'Huston', '2010-03-31 10:19:00');
SELECT t1.id, t1.name, sub_t.date
FROM t1
JOIN (SELECT DATE(date) as date
FROM t1
GROUP BY DATE(date)
HAVING COUNT(id) > 1) sub_t ON (sub_t.date = DATE(t1.date));
Returns:
+----+-------+------------+
| id | name | date |
+----+-------+------------+
| 1 | John | 2010-03-27 |
| 2 | Mike | 2010-03-27 |
| 4 | Anna | 2010-03-29 |
| 5 | Maria | 2010-03-29 |
| 6 | Penny | 2010-03-29 |
+----+-------+------------+
5 rows in set (0.02 sec)