How to query a view from a eplore withouth joining it

Hi,

I’m trying to solve a problem with a model, to adapt it to my necessities.

I have an explore joined:

explore: order_items {
join: users {
type: left_outer
sql_on: ${order_items.user_id} = ${users.id} ;;
relationship: many_to_one
}
}

When I try to query dimensions from both views, it works OK, joining both tables. The problem comes when I try to use dimensions from only “users” view. The join happens anyways and I haven’t found any means to limit that.

# When only using a field form "users"

SELECT
users.age AS users_age
FROM order_items
AS order_items
LEFT JOIN users
AS users ON order_items.user_id = users.id
GROUP BY
1
ORDER BY
1
LIMIT 500

# The result I would desire
SELECT
users.age AS users_age
FROM users
AS users
GROUP BY
1
ORDER BY
1
LIMIT 500

There is any way to limit this within the same explore? I have tried some optinos, like trying to limit join depth, but I can’t make it worth.

Thanks in advance.

Regards.

0 1 88
1 REPLY 1

Explores work on specifying a base view and then joining view, just like in a SQL query. Therefore, you can’t just flip it and “mark” one of the joins as a base. You would have to create a separate explore called Users.

Top Labels in this Space
Top Solution Authors