Skip to content

Instantly share code, notes, and snippets.

Avatar

Bryan Marty bxm156

View GitHub Profile
View gist:762c4a5009aa35034906

Keybase proof

I hereby claim:

  • I am bxm156 on github.
  • I am bryanmarty (https://keybase.io/bryanmarty) on keybase.
  • I have a public key whose fingerprint is RETU RN T HIS. PGP. GET_ FING ERPR INT( ); }

To claim this, I am signing this object:

@bxm156
bxm156 / marketbasket_all_in_one.sql
Created Dec 6, 2012
Market Basket One Gigantic Query for ServicePad
View marketbasket_all_in_one.sql
SELECT event_id as recommended_event_id FROM (
(SELECT event1 AS event_id FROM (SELECT tempP.event1 FROM (
SELECT r1.event AS event1, r2.event AS event2
FROM (SELECT user_id AS user, event_id AS event
FROM service_serviceenrollment WHERE event_id IN (
SELECT event_id FROM service_serviceenrollment GROUP BY event_id HAVING COUNT(*) >= threshold
)) AS r1, (SELECT user_id AS user, event_id AS event
FROM service_serviceenrollment WHERE event_id IN (
SELECT event_id FROM service_serviceenrollment GROUP BY event_id HAVING COUNT(*) >= threshold
)) AS r2