 <p>Even @juergen has suggested better option and also guided you how to solve your problem in your way but if stil you are facing issue how to do then you can follow below query-</p> <pre><code>SELECT p.id AS pid, n1.image_1, n2.image_2, n3.image_3, big, small FROM photos AS p LEFT JOIN news AS n1 ON n1.image_1=p.id LEFT JOIN news AS n2 ON n2.image_2=p.id LEFT JOIN news AS n3 ON n1.image_3=p.id ORDER BY n.id DESC; </code></pre>