我有以下表格:
+---------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+----------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| CAMXTimeStamp | datetime | YES | | NULL | |
| CAMXMessage | longtext | YES | | NULL | |
+---------------+----------+------+-----+---------+----------------+
我正在尝试选择ID最低的记录:
select id from camxmessages having min(id);
然后桌子丢失了所有记录,我没有得到任何结果,知道我做错了什么?
答案 0 :(得分:4)
SELECT *
FROM camxmessages
ORDER BY id
LIMIT 1
答案 1 :(得分:4)
SELECT MIN(ID)
FROM CAMXMESSAGES