I am trying multiple joins in a single query to pull data from multiple tables.

Tables - `Places_main`, `User_interests`, `travel_list`

**`User_interests` table data:**

```
ID USERID INTERESTID
84  27       |18|   
85  27       |18|   

```

**`Places_main` table data**

```
ID TAGS

1  |5|18|35|34|33
2  |5|18|35|33|34

```

**What I am trying to get here :**

Get list of places from Places\_main table which is not in travel\_list, and for "tags" column of places\_main there is an entry in User\_interests table in interestID column.

**This is query 1**

```
select * from places_main pm 
LEFT JOIN travel_list tl ON pm.ID = tl.PLACEID 
LEFT JOIN user_interests ui ON pm.TAGS NOT LIKE '%' || ui.interestid || '%'
where tl.ID is null and ui.ID is null

```

**This is same query 2 which is same as above but with hard-coded data**

```
select * from places_main pm 
LEFT JOIN travel_list tl ON pm.ID = tl.PLACEID 
LEFT JOIN user_interests ui ON pm.TAGS NOT LIKE '%18%'
where tl.ID is null and ui.ID is null

```

When I execute query with hardcoded value, it returns expected results, but when I run without hard-coded(1st query), it returns nothing.

How do I get get expected result without using hardcoded value.

Thanks for help in advance.

**Edit:**

If I remove pipe form table data and compare it as single value, it works fine. But with pipe in row it returns empty. Any suggestion for this.