Thanks for the replies!
I think I might have to do what Johanafm is suggesting, I'm not sure I can get a join to work, I tried.
This is a simple photo gallery. There are 2 tables.
album
album_id
name
description
photos
photo_id
img_url
album_id
album_id is a foreign key that just sorts out what album each photo record belongs to.
I am creating a simple list of all albums with their name, description, and their max(photo_id) photo as an album cover. The problem with a join query is that I want even albums without images in them to display in this list, and when I join them it omits any albums that have no photos assigned to their album id. I instead want it to display "no image", the album name, and album description.
Is there a way to include albums that have a null value for max(photo_id) and use an if condition to display "no image"? That's why I currently have a separate function to run the max(photo_id) query and handle the 'if no photos, print 'no image', else print 'the image' in the function.
Hope that make sense, thanks for the genius ideas.