SQL query to return only filled records from the table

0

How do I make my query return only records that are filled in? My table has some blank records that are returned by the association.

<?php
$consulta = $pdo->query("SELECT * FROM ws_so_wind, ws_soft_gallery WHERE id_soft = id_img AND id_soft = $id_soft ");
foreach ($consulta as $foto) {
?>
<a href="<?= BASEIMG ?><?= $foto['url_gallery']; ?> " data-lightbox="set" data-title="">
<img itemprop="screenshot" class="screenshot" src="<?= BASEIMG ?><?= $foto['url_gallery']; ?> "></a>
<?php } ?>
    
asked by anonymous 04.04.2017 / 16:04

1 answer

1

You have a really nice explanation on this link: What is the difference between INNER JOIN and OUTER JOIN?

I think this solves your problem, but I strongly recommend you study the join clauses, they will help you a lot on your journey: D

$consulta = $pdo->query("SELECT * FROM ws_so_wind INNER JOIN ws_soft_gallery ON id_soft = id_img WHERE id_soft = $id_soft");
    
04.04.2017 / 18:53