How to update case statement in join to use aliasing instead?

I have a report that’s running off an Explore in my model, but one of the joins to a view needs to be updated for performance. Right now it’s using a case statement, but it’s been recommended to me to use 2 aliased versions of the view to join in instead. Here’s a rough, generalized example of what it currently looks like in SQL report:

left join info AS info on
case
when x.customer_or_company = 'customer'
then customer.id = info.id
else company.id = info.id
end

here’s the alternate way to update it for performance:

left join info AS customer_info
ON customer.id = customer_info.id

left join info AS company_info
ON company.id = company_info.id

The info view is just a standard, simple view with about 10 different dimensions, and the SQL for each dimension is ${TABLE}.dimension

What would be the best way to go about updating this in the Looker model? If I create two aliased tables in the explore using the from parameter for the join, how will this affect the info fields in the report? Do I need to update the info view to use case statements for each of the dimensions in this case instead?

1 0 206
0 REPLIES 0
Top Labels in this Space
Top Solution Authors