Hi guys,
What kind of query should I make to mySQL to get the ten greatest values from a colum? (I want to display the TOP TEN SOLD ITEMS in my site).
Than you,
Pepe (Spain)
SELECT numbersold FROM table ORDER BY numbersold DESC LIMIT 0,10
should do it. I think...
Dan
www.boxuk.com
You might want to read a manual once in a while.
SELECT * FROM table ORDER BY some_field DESC LIMIT 10;
this selects all fields from table "table" sorted by some_field in a descending order (biggest first) and limits the results to the first 10.
how would you then access this query?? would you then fetch this query as an array?? i tried it, it didnt seem to work, im a little confused with this.
thanks
You would run the query like you would any other query, the method of getting the data is all the same.
If using MySQL with PHP is new for you you may want to read this: http://www.hvt-automation.nl/yapf/index.php?cmd=viewitem&itemid=12