ok i have two things i need to do with a table in db which is called relation, it represents relations between a lot or other tables.
first thing i need is statistics of last created relations by date somthing that will output like "comments per week 00.9,less then last week".
second thing i need is to call just the last 5 rows of the table (here i can do the rest and output the data any way i want).
some db statistics and order
Moderator: General Moderators
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: some db statistics and order
To calculate the comments per week, just divide the number of comments by the amount of time it's been up.
Re: some db statistics and order
ok thats helpful thank you
but how do i call the last 5 rowes of a table in mysql?
but how do i call the last 5 rowes of a table in mysql?
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: some db statistics and order
Assuming you have a auto-increment column `id`, the SQL will look like this:
Code: Select all
SELECT * FROM my_table ORDER BY id DESC LIMIT 5Re: some db statistics and order
thank you thats awsome!
(i always use id its a comfortable way to manipulate data)
(i always use id its a comfortable way to manipulate data)