Question: I am having some trouble finding a solution in mySQL, I have 2 tables where in the one I have my images and in the other I have my votes and image\_id that I bind together using this line:

```
$sql = "SELECT `image`  FROM `sh_images`, `sh_votes` WHERE
`sh_images`.`id`=`sh_votes`.`image_id` ORDER BY `vote` DESC";

```

Everything works fine except that the images that aren't voted yet aren't showing. So do you have a solution for me?

Answer: 
You should be using `LEFT JOIN` on this.

`LEFT JOIN` is different from `INNER JOIN` (*which is what you are doing right now*). `LEFT JOIN` displays all the records define on the *LeftHand side* whether it has a matching record or none on the *RightHand side* table on the result.

```
SELECT  image, vote  
FROM    sh_images 
        LEFT JOIN sh_votes 
            ON sh_images.id = sh_votes.image_id 
ORDER   BY vote DESC

```

* [SQLFiddle Demo](http://www.sqlfiddle.com/#!2/747ce/3)

To further gain more knowledge about joins, kindly visit the link below:

* [Visual Representation of SQL Joins](http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html)
Sure, just use a LEFT JOIN:

```
SELECT image 
FROM sh_images
LEFT JOIN sh_votes ON sh_images.id=sh_votes.image_id 
ORDER BY vote DESC;

```

Btw, consider using `INNER JOIN` syntax for your straight joins, it's easier to prevent a missing join condition that way.