这是我的情况:我有一个重复值有效的表(ID 字段除外),我只想检索唯一值。
例如,如果我有寄存器:
+----+--------------+-------------+------+------+-------+-----+
| ID | SATELLITE_ID | ATT_TYPE_ID | TIME | ROLL | PITCH | YAW |
+----+--------------+-------------+------+------+-------+-----+
| 1 | 1 | 1 | 2012 | 1.0 | 2.0 | 1.3 |
+----+--------------+-------------+------+------+-------+-----+
| 2 | 1 | 1 | 2012 | 1.0 | 2.0 | 1.3 |
+----+--------------+-------------+------+------+-------+-----+
| 3 | 1 | 1 | 2011 | 1.0 | 2.0 | 1.3 |
+----+--------------+-------------+------+------+-------+-----+
我只想检索 2 和 3(ID 1 和 2 是“相等的”,而 3 的时间不同)。
这是表结构
mysql> describe attitude;
+--------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+----------------+
| ID | int(11) | NO | PRI | NULL | auto_increment |
| SATELLITE_ID | int(11) | NO | | NULL | |
| ATT_TYPE_ID | int(11) | NO | | NULL | |
| TIME | varchar(4) | NO | | NULL | |
| ROLL | double | NO | | NULL | |
| PITCH | double | NO | | NULL | |
| YAW | double | NO | | NULL | |
+--------------+--------------+------+-----+---------+----------------+
谢谢。