Skip to content

Instantly share code, notes, and snippets.

@ermolaev
ermolaev / apriori
Last active August 29, 2015 14:06 — forked from thinkerbot/madlib_example.sql
Madlib PostgreSQL
CREATE TEMP TABLE test_data ON COMMIT DROP AS (SELECT
warehouses.product_id::TEXT,
user_id AS transaction_id
FROM
"line_items"
INNER JOIN "users" ON "users"."id" = "line_items"."user_id"
INNER JOIN "warehouses" ON "warehouses"."id" = "line_items"."warehouse_id"
INNER JOIN "products" ON "products"."id" = "warehouses"."product_id"
AND (products.deleted_at IS NULL)
WHERE
@ermolaev
ermolaev / README.md
Last active August 29, 2015 14:05 — forked from markmarkoh/README.md