|
I think you're looking for,
select distinct(name),date,location FROM tableName GROUP BY name;
You only want the group by on the name, since that's the one that you're making distinct.
mysql> create table test ( name char(20), date char(20), location char(20) );
Query OK, 0 rows affected (0.16 sec)
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| test |
+----------------+
1 row in set (0.00 sec)
mysql> show fields from test;
+----------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+----------+------+-----+---------+-------+
| name | char(20) | YES | | NULL | |
| date | char(20) | YES | | NULL | |
| location | char(20) | YES | | NULL | |
+----------+----------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> insert into test values ( 'buran', '12345', 'orlando' );
Query OK, 1 row affected (0.00 sec)
mysql> insert into test values ( 'buran', '67890', 'indiana' );
Query OK, 1 row affected (0.00 sec)
mysql> insert into test values ( 'twinkley', 'abc123', 'michigan' );
Query OK, 1 row affected (0.00 sec)
mysql> select distinct(name),date,location from test group by name;
+----------+--------+----------+
| name | date | location |
+----------+--------+----------+
| buran | 12345 | orlando |
| twinkley | abc123 | michigan |
+----------+--------+----------+
2 rows in set (0.00 sec)
mysql>
__________________
[this signature intentionally left blank]
|