This is a discussion on SELECT query with negative LIMIT? within the MySQL Database forums, part of the Database Forums category; Is possible execute the query below: SELECT * FROM table LIMIT -10 I need extract the last 10 rows inserted in ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
antoniog wrote:
> Is possible execute the query below: > > SELECT * FROM table LIMIT -10 > > I need extract the last 10 rows inserted in table. > > That query running? > > Thank you for all > > antoniog Use an auto_increment column and sort DESC then use limit 10 |
|
|||
|
antoniog <agpquota@tucerchinoitroviamo.com> wrote:
> Is possible execute the query below: > > SELECT * FROM table LIMIT -10 > > I need extract the last 10 rows inserted in table. Hmmz, I assume there's some way the 'last rows' can be selected by a field, either a unique incrementing 'id', or some sort of 'add_time' SELECT * FROM TABLE ORDER BY id DESC LIMIT 10 -- Rik Wasmus Posted on Usenet, not any forum you might see this in. Ask Smart Questions: http://tinyurl.com/anel |
|
|||
|
Thank you
I will try it Paul Lautman ha scritto: > antoniog wrote: >> Is possible execute the query below: >> >> SELECT * FROM table LIMIT -10 >> >> I need extract the last 10 rows inserted in table. >> >> That query running? >> >> Thank you for all >> >> antoniog > > Use an auto_increment column and sort DESC then use limit 10 > > |
|
|||
|
Thank you
I will try it Rik ha scritto: > antoniog <agpquota@tucerchinoitroviamo.com> wrote: > >> Is possible execute the query below: >> >> SELECT * FROM table LIMIT -10 >> >> I need extract the last 10 rows inserted in table. > > Hmmz, I assume there's some way the 'last rows' can be selected by a > field, either a unique incrementing 'id', or some sort of 'add_time' > > SELECT * FROM TABLE ORDER BY id DESC LIMIT 10 > > --Rik Wasmus > Posted on Usenet, not any forum you might see this in. > Ask Smart Questions: http://tinyurl.com/anel |