bank remarking number 1 2009-01-05 18:16:29
bank remarking number 2 2009-01-05 18:16:31
bank remarking number 3 2009-01-05 18:16:32
bank remarking number 4 2009-01-05 18:16:33
i need to select only the last bank which is having remarking number4 and is the latest data that inserted into data base, i dont want to use time for this matter is there any other way?.
thx
how to select only 1 data out of few?
Moderator: General Moderators
Re: how to select only 1 data out of few?
SELECT `remark` FROM `remarks` WHERE `project_name` = 'bank' this is showing all, whereas i need the last remark
Re: how to select only 1 data out of few?
+
[sql]ORDER BY remarking_number DESCLIMIT 1[/sql]
[sql]ORDER BY remarking_number DESCLIMIT 1[/sql]
There are 10 types of people in this world, those who understand binary and those who don't
-
jason.carter
- Forum Commoner
- Posts: 35
- Joined: Sat Jan 10, 2009 10:05 am
Re: how to select only 1 data out of few?
Try a sub query if you want
SELECT remarks FROM remarks WHERE remark_id = (SELECT max(remark_id) FROM remarks)
If you have a remark_id then it is fairly easy to pull the latest row.
SELECT remarks FROM remarks WHERE remark_id = (SELECT max(remark_id) FROM remarks)
If you have a remark_id then it is fairly easy to pull the latest row.