Skip to content
Discussion options

You must be logged in to vote

Let's try this:

CREATE MATERIALIZED VIEW companies_bucketed AS
WITH market_cap_with_dummy AS (SELECT company_id, market_cap, 1 as market_dummy_col),
WITH bucket_with_dummy AS (SELECT bucket_id, min_cap, max_cap, 1 as bucket_dummy_col)
SELECT 
    c.company_id,
    c.market_cap,
    b.bucket_id
FROM market_cap_with_dummy c
JOIN bucket_with_dummy b
on c.market_cap >= b.min_cap 
AND c.market_cap < b.max_cap
AND c.market_dummy_col = b.market_dummy_col

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@marigov
Comment options

Comment options

You must be logged in to vote
1 reply
@marigov
Comment options

Answer selected by marigov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants