Question: I have a problem with queries and the whole logic of sql script.

My database has 2 tables. The first "travel" table has many unique trips with many columns. The second table "like" is the likes that exist for each trip as well as the name of the country to which the trip belongs

Now I want to `select * from trips order by likes where the country = "Greece".`

First of all I make the following code

```
SELECT T.*
FROM trips T INNER JOIN
     tripslikes L
     ON T.trip_id = L.trip_id
Where T.country_name = "Greece";

```

the results are all trips where the country = "Greece" this is repeated as many times as there are likes that have been made in this trip.

The problem is I'm loosing on my results the trips that doesn't have any like until now. The reason of this is because `ON T.trip_id = L.trip_id` <----- on this the trip\_id from trips which have 0 likes doesn't exist on trip\_id from likes and this is correct.

Any idea how can I get it the trips without any record on table likes (Meaning the trips whitout any record of like until now) ?

UPDATE1

```
select *, count(*) Total
from 
(
  SELECT T.*
FROM trips T
INNER JOIN tripslikes L
ON T.trip_id = L.trip_id Where T.country_name = "Greece"

) d
group by trip_id;

```

Thank you very much!

Answer: 
Based on your code it looks like you're using jquery, rather than just plain javascript.

I've updated your snippet to:

* Run your function based on a button click, rather than as soon as the document is ready
* Find all td's with the word "Hello" using the JQuery `:contains()` selector
* Set a class with the css `visibility: hidden`, because using display: none would make the TD's disappear completely and mess up your table layout. If you wanted the cells gone completely, you should still do `display: none`

```js
$(document).ready(function() {
  let tdsWithHello = $("table#data-table td:contains('Hello')");

  $("#btn-only-world").click(function() {
      tdsWithHello.each(function () {
        $(this).addClass("hide"); 
      });
    });
});
```

```css
.hide {
  visibility: hidden;
}
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="data-table">
  <table class="table table-bordered text-center table-dark" id="data-table">
    <tr>
      <td>Only World</td>
      <td>b</td>
    </tr>
    <tr>
      <td>Hello</td>
      <td>World</td>
    </tr>
    <tr>
      <td>Hello</td>
      <td>Hello</td>
    </tr>
    <tr>
      <td>World</td>
      <td>World</td>
    </tr>
    <tr>
      <td>World</td>
      <td>World</td>
    </tr>
    <tr>
      <td>Hello</td>
      <td>Hello</td>
    </tr>
    <tr>
      <td>World</td>
      <td>Hello</td>
    </tr>
  </table>
</div>
<div class="btn-wrap">
  <div class="d-grid gap-2 col-6 mx-auto">
    <button id="btn-only-world" class="btn btn-light" type="button">Only World</button>
  </div>
</div>
```
The value of `dataTableText` will never be `"Hello"`. It will be the text value of the complete table. Your `if`-condition is therefore never true.

So this line:

```
$('table tbody').find('td').style.display = "none";

```

is never executed. If it were, it would hide all `<td>`s in the table, regardless of their content.