Night Walker
Night Walker

Reputation: 21260

Select statement strange behavior

I have following table :

+---------------+----------+------+-----+---------+----------------+
| Field         | Type     | Null | Key | Default | Extra          |
+---------------+----------+------+-----+---------+----------------+
| id            | int(11)  | NO   | PRI | NULL    | auto_increment |
| CAMXTimeStamp | datetime | YES  |     | NULL    |                |
| CAMXMessage   | longtext | YES  |     | NULL    |                |
+---------------+----------+------+-----+---------+----------------+

I am trying to select the record with the lowest id :

select id from camxmessages having min(id);

And then the table looses all the records , and I not getting any result , any idea what i do wrong ?

Upvotes: 0

Views: 89

Answers (2)

Giann
Giann

Reputation: 3192

SELECT MIN(ID)
FROM CAMXMESSAGES

Upvotes: 4

ypercubeᵀᴹ
ypercubeᵀᴹ

Reputation: 115520

SELECT *
FROM camxmessages 
ORDER BY id
LIMIT 1

Upvotes: 4

Related Questions