|
-
March 19th, 2009, 04:26 AM
#1
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
-
March 19th, 2009, 04:34 AM
#2
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.
-
March 19th, 2009, 04:55 AM
#3
Re: mysql order by column from another table
ooouh...thanks a lot davide... that's exactly what I needed!
thanks again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|