mksolutions
IS-IT--Management
Here is a sample query I am working with:
SELECT DISTINCT Roster.RosterID AS RosterID FROM Roster INNER JOIN Photos ON Roster.RosterID = Photos.RosterID INNER JOIN Users ON Photos.UserID = Users.UserID INNER JOIN Roads ON Roads.RoadID = Roster.RoadID ORDER BY Photos.PhotoID DESC LIMIT 200.
The Order By part will not work until I put this part in:
Photos.PhotoID AS PhotoID
HOWEVER, when I do that, the query returns different results. How can I order by something without putting it into the query....OR how can I put that into the query yet only return the DISTINCT part?? I am stuck in a catch 22 here.
Thanks for the help!
SELECT DISTINCT Roster.RosterID AS RosterID FROM Roster INNER JOIN Photos ON Roster.RosterID = Photos.RosterID INNER JOIN Users ON Photos.UserID = Users.UserID INNER JOIN Roads ON Roads.RoadID = Roster.RoadID ORDER BY Photos.PhotoID DESC LIMIT 200.
The Order By part will not work until I put this part in:
Photos.PhotoID AS PhotoID
HOWEVER, when I do that, the query returns different results. How can I order by something without putting it into the query....OR how can I put that into the query yet only return the DISTINCT part?? I am stuck in a catch 22 here.
Thanks for the help!