Jump to content


Check out our Community Blogs

Vswe

Member Since 30 Apr 2009
Offline Last Active Jul 23 2014 08:47 AM
-----

Topics I've Started

Order by different tables

27 February 2012 - 01:31 AM

I have one table called Users and then one called Messages and one for Votes. With a join I join the Messages and Votes with the Users(since all Messages and Votes are done by a certain user). The thing is, I want to order the users by the most recent `time`from both the Messages and Votes. It might be a bit difficult to understand what I mean so I post the quarry I have so far. The bold black part is the one I don't know about

SELECT Users.*
FROM((Users
LEFT JOIN Votes ON Users.id = Votes.page
)
LEFT JOIN Messages ON Users.id = Messages.page

)
WHERE Users.id<>28
GROUP BYUsers.id
ORDER BY(Messages.time,Votes.time)DESC

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download