mysql order by column from another table
hi
i'd try to ask in the most simple manner... :)
i've a table named 'first' which contains these field:
user | name | points
and second table named 'second' which contain these field
user | title |
my question is, I want to select all fields in table 'second' and sort them based on the value of column 'points' from table1.. how do I do it?
btw i'm trying to use PHP to do this... but I asked in the database forum since I think it's mostly a mysql issue..
thanks in advance
Re: mysql order by column from another table
Hi all.
Yes, it's a database topic.
If table first is linked to table second with user field, as I image, you can write something like this
Code:
SELECT S.*
FROM FIRST F, SECOND S
WHERE F.USER = S.USER
ORDER BY F.POINTS
I hope this will help you.
Re: mysql order by column from another table
ooouh...thanks a lot davide... that's exactly what I needed!
thanks again