1

I have a select like:

SELECT * FROM xxx WHERE id = 5 ORDER BY id DESC

But I need to order my select with the "Name" column that is into another Table... How can I do ?

1
  • 2
    post the table structure of the two tables Commented Mar 24, 2011 at 15:39

2 Answers 2

6
SELECT  xxx.*, yyy.name
FROM    xxx
JOIN    yyy
ON      yyy.x_id = xxx.id
WHERE   xxx.id = 5
ORDER BY
        yyy.name DESC
Sign up to request clarification or add additional context in comments.

Comments

1

I believe this is heading in the right direction:

SELECT * from xxx LEFT JOIN yyy ON yyy.name = xxx.whateverkey WHERE id = 5 ORDER BY yyy.name DESC

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.