Jump to content

Archived

This topic is now archived and is closed to further replies.

Demonic

Join.

Recommended Posts

Can someone tell me how I could order a table by another tables Id using Join mysql syntax.

Its confusing.

Select * FROM table1,table2 ORDER BY table2.id

Is that how I would do it?

Share this post


Link to post
Share on other sites
can you explain that? the t1 and t2 threw me off bad.(same thing happened when looking at the manual ???)

Share this post


Link to post
Share on other sites
t1 is just a short name label for table1.
You can still use the original table1 name.

SELECT *
FROM table1
JOIN table2
ON table1.id = table2.id
ORDER BY table2.id


same thing.

Another way to join is:
SELECT * FROM table1, table2
WHERE table1.id = table2.id
ORDER BY table2.id

However, the first method is better since there's more things with you can do using  a JOIN clause.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.