Hi guys,

I have a problem sorting values comming out of a db. It is not as easy.

Here is the prob:
One table containing user points.
Other table containing reports with rankings
For each top 10 report (the 10 reports with the most ranking) there are 20
extra points granted

Now I would like to get the top 5 members out of the db. If I only pull out
the user table ordered by points desc limit 5 I might miss a user with a top
10 report and 20 extra points.

So I thought about sorting the array afterwards with asort, but then I loose
the asoziation with the user_id.

Maybe there is a way to sort the other arrays with the same sorting algo? Or
a way to include a iff clause in the query?

currently I am doing:
SELECT
    u_name,
    id,
    points
FROM user
WHERE
    points > 0
ORDER by points desc
LIMIT 5

and the top10 reports extra.

Has anybody a good idea on that?

Andy



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to