| Author |
How to query a certain number of data?
|
Ken Shamrock
Ranch Hand
Joined: Jan 23, 2002
Posts: 139
|
|
For example, if I want to query the maximum latest 1000 records. How can I ? For (Select Max(column) from XXX where..) can only display the max value of certain column
|
Thanks everyone who helped me
|
 |
Andy Bowes
Ranch Hand
Joined: Jan 14, 2003
Posts: 171
|
|
The SQL that you need to do this would depend upon the database that you are connecting to. On Oracle you could do something like: SELECT * FROM MYTABLE ORDER BY DATE_CREATED DESC WHERE ROWNUM <= 1000 The order by clause will sort the records so that the most recent ones are retrieved first, the where clause will then limit the no of records returned. I am not sure of the syntax for other DBs but it will be pretty similar if it is supported at all. Hope this helps [ March 28, 2003: Message edited by: Andy Bowes ]
|
Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams
|
 |
Ken Shamrock
Ranch Hand
Joined: Jan 23, 2002
Posts: 139
|
|
Thanks andy, but i am using MySQL, do anyone know if there's any method can work in mysql?thanks
|
 |
 |
|
|
subject: How to query a certain number of data?
|
|
|