I've read tutorials and forums, but I just dont get it or it's not possible to do what I want...
I've got two tables (a bit cut here):
albums (aid, visibility)
pictures (pid, aid, name, title) // pid increases by 1 for each new row
I'd like to select the latest addition from pictures, but if aid for that picture in table albums has a visibility set to 1 next row should be checked.
Unclear enough...?
SAMPLE:
albums
1, 0
2, 1
pictures
11, 2, pic1.gif, Pic1
10, 1, pic2.gif, Pic2
In this little sample it would jump Pic1 with highest pid (11) because albums.aid visibility is 1. Instead it would chose Pic2
Maybe a bit clearer
So is it possible to do in one go, or would I need to make two querys?
I've got two tables (a bit cut here):
albums (aid, visibility)
pictures (pid, aid, name, title) // pid increases by 1 for each new row
I'd like to select the latest addition from pictures, but if aid for that picture in table albums has a visibility set to 1 next row should be checked.
Unclear enough...?
SAMPLE:
albums
1, 0
2, 1
pictures
11, 2, pic1.gif, Pic1
10, 1, pic2.gif, Pic2
In this little sample it would jump Pic1 with highest pid (11) because albums.aid visibility is 1. Instead it would chose Pic2
Maybe a bit clearer
So is it possible to do in one go, or would I need to make two querys?