Mysql Math question

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Texan
Forum Newbie
Posts: 9
Joined: Mon Dec 20, 2004 9:23 pm

Mysql Math question

Post by Texan »

I am trying to do something. I don't even know if it will work.
Will this work? Or do I need to do it someother way?

Code: Select all

SELECT * FROM Logs WHERE id > MAX(id)-7 ORDER BY date_entered
I am trying to only show the last 7 entries in the Logs table.
I know its stupid, and there has to be an easier way to do this,
but I am very tired and not thinking quite straight.

Thanks
method_man
Forum Contributor
Posts: 257
Joined: Sat Mar 19, 2005 1:38 am

lol

Post by method_man »

get some rest lol
Texan
Forum Newbie
Posts: 9
Joined: Mon Dec 20, 2004 9:23 pm

Post by Texan »

Thanks I would love to.....but this will haunt me till
I finish it. But 2 karma points for wishing me some much
needed sleep.


Hit me up for 6 pack sometime....
method_man
Forum Contributor
Posts: 257
Joined: Sat Mar 19, 2005 1:38 am

lol

Post by method_man »

lol
yes i got 2 karma points
what can i get with karma points? lol
Texan
Forum Newbie
Posts: 9
Joined: Mon Dec 20, 2004 9:23 pm

Post by Texan »

I don't know...a bus ticket or something?
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Please show your table stucture.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Try This:

Code: Select all

SELECT * FROM Logs ORDER BY date_entered DESC limit 0,7
Post Reply