Hello- I am trying to do a join, but I keep getting either too many results, or none at all. I have table2 that has a user id, picture caption, and a picture id. The user can add captions to the pictures they add to their list. I also have table1 that has picture id, and picture caption (which may be null). I want to be able to show the original caption (from table1), or if there isn't a caption, show the caption that the person has created in table2. Here is what I tried:
SELECT table1.caption, table2.caption FROM table1, table2 WHERE (table1.caption = '$caption') AND (table2.caption = '$cation'
This works only if the user has created a caption where there was an original caption- the caption from table1 and table2 show. I want to be able to pull table1 caption and table2 caption, even if either table is missing a caption (null).
I also tried:
SELECT table1.caption, table2.caption FROM table1, table2 WHERE table1.caption = 'table2.caption
This brings up two different captions for table1 and table2 since there are 2 captions in table2. Table1 has 100+ captions and has been limited by only 2 captions added to table2, I assume. Once again, I want to show table1 caption and table2 caption, based on the picture id. How can I do this?
Sorry if this is hard to understand, it is difficult writing it out clearly.