Page 1 of 1

Max numbers... ordering... etc.

Posted: Sun Jun 24, 2007 9:50 pm
by Mightywayne
So here's what I've got.

There's 10 rows: news1, news2, news3..news10. Each of them has an ID in it, and that ID represents the piece of news in another table. (they have the same IDs, long story)

So the way I update is weird, but what matters here is the solution.

My values for the news entries will be like,

news1 = 10, news2 = 14, news3 = 30

And what I need to do, is take all of those entries, and find which is the lowest of them all, and replace it.

Basically, I just need a way to find those 10 values, and find which is lowest of them. How do I do it?

Posted: Sun Jun 24, 2007 9:52 pm
by Benjamin
Put them into an array and sort them.

Posted: Sun Jun 24, 2007 10:08 pm
by jimthunderbird
Maybe use "select {your_news_value_field_name} from {$your_news_table_name} order by {your_news_value_field_name} limt 0,10";

With my best,
Jim

Posted: Mon Jun 25, 2007 5:20 am
by volka

Code: Select all

SELECT Min(ID) From tablename
see http://www.w3schools.com/sql/func_min.asp

Posted: Mon Jun 25, 2007 11:51 am
by Mightywayne
Ah, all've you've been useful. Thank ya kindly.