This page refers to the
sqlparameter that is part of a join.
sqlcan also be used as part of a field, as described on the
sql(for fields) parameter documentation page.
sqlcan also be used as part of a derived table, as described on the
sql(for derived tables) parameter documentation page.
sql allows you to write the raw SQL that will join a view to an Explore. It is currently used almost exclusively to execute
RIGHT JOIN, which is not supported by the
type parameter. Otherwise, there are better parameters to use to execute joins.
Previous to Looker 3.10,
sql was the only method available to execute a join that was not a
LEFT JOIN. For example, before 3.10 you may have created an
INNER JOIN between an
event Explore and a
member view like this:
As of Looker 3.10 the join should be executed with
foreign_key instead, while the type of join should be defined using
type as follows:
The second common use case for
sql was to join tables from two different database, which is called a “Federated Join”. For example, you might have written this LookML:
This can now be achieved by using
sql_table_name instead, as follows: