Follow us on Twitter!
Things are more like they are now than they have ever been before. - Dwight D. Eisenhower
Thursday, April 24, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 31
Guests Online: 25
Members Online: 6

Registered Members: 82895
Newest Member: kevy90
Latest Articles
View Thread

HellBound Hackers | Computer General | Webmasters Lounge

Author

SQL issues


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 12-03-07 00:35
i need to take info off of a db from the last rows of a table rather than the first but the table is always growing. How would i get the last rows off the table that i dont know the actual number of? any help is appreciated.
thx
atrcomb

edit: i forgot to add i have a field in the table that increments with each new addition. If i use ORDER BY how would i get the largest numbers?




Edited by on 12-03-07 00:37
Author

RE: SQL issues


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 12-03-07 00:55
ok assuming you have the incrementing field you have is named id, and you want the last 5 rows, this statement should work

SELECT * FROM table ORDER BY id DESC LIMIT 0,5

i am pretty sure that should work.




Edited by on 12-03-07 00:55
Author

RE: SQL issues


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 12-03-07 00:58
sweet thx chislam

edit: kinda interesting because i did need the last five rows of the field named id...what a coincidence...lol




Edited by on 12-03-07 01:00
Author

RE: SQL issues


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 12-03-07 01:34
Smile