-
-
Save bbengfort/6588786 to your computer and use it in GitHub Desktop.
Creates a test data set from star delta 0 - selecting ten sample coalesced urls and product names from the shelves for each vendor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT product, url FROM | |
(SELECT ROW_NUMBER() OVER (PARTITION BY vendor ORDER BY product DESC) AS r, t.* FROM | |
(SELECT vendor.name AS vendor, product.name AS product, COALESCE(shelf.detail_url, shelf.buy_url, NULL) AS url | |
FROM shelf | |
JOIN product ON product.id = shelf.product_id | |
JOIN vendor ON vendor.id = shelf.vendor_id) | |
AS t) | |
AS x | |
WHERE x.r <= 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment