Skip to content

Instantly share code, notes, and snippets.

View gmacdougall's full-sized avatar

Gregor MacDougall gmacdougall

  • Toronto, Ontario, Canada
View GitHub Profile
SELECT COUNT(*)
FROM "spree_products"
LEFT OUTER JOIN "spree_variants" ON "spree_variants"."product_id" = "spree_products"."id" AND "spree_variants"."deleted_at" IS NULL
WHERE "spree_products"."deleted_at" IS NULL
AND spree_variants.id NOT IN (SELECT variant_id FROM spree_well_amy_variant_lifestyles WHERE "lifestyle_id" IN (1, 2, 3, 4));