Google Sheet query as SQL joining data sets

Hi!

I have the following query that is used to return records from three search boxes.

SELECT *
FROM {{truckLoadTracker.data}} a join {{regionsByOrigin.data}} b on a.[Origin LMH] = b.Location

WHERE

 (  
    {{ !search.value }}
    OR VIN ILIKE {{ '%' + search.value + '%' }}
  ) 
  
AND (
    {{ !locationSelect.value}} 
    OR [Current Location] ILIKE {{ "%" + locationSelect.value + "%" }}
  )
     
AND (
    {{ !regionSelect.value}} 
    OR b.Region ILIKE {{ "%" +regionSelect.value + "%" }}
  )

The issue is that this is returning duplicate rows but I cant figure out the syntax to convert this to a left join correctly.

Hey @AndrewOwen! :slight_smile:

What sets of data are you looking for?

https://www.w3schools.com/sql/sql_join.asp

If you use left join instead of join, does it not return the data you're looking for?