I have two tables, shows and objects. I want to print the latest objects and names for them. Now I am doing it like this:
SELECT MAX(objects.id) as max_id, shows.name, shows.id
FROM shows, objects
WHERE shows.id = objects.showId
GROUP BY shows.name
however, if I also want to get an episode of an object, I cannot put it as SELECT object.episode [...], because then it will not automatically select the object that is MAX(objects.id), so my question is how to do it?
If you haven't figured out my tables yet, they will be like this:
and:
- The objects
- ID
- name
- episode
- season
- showId
Using MySQL. Thank!
source
share