Skip to content

Instantly share code, notes, and snippets.

@sevenseacat
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save sevenseacat/756c6d602376fdaf7d5e to your computer and use it in GitHub Desktop.

Select an option

Save sevenseacat/756c6d602376fdaf7d5e to your computer and use it in GitHub Desktop.
SELECT "spree_products".*
FROM "spree_products"
INNER JOIN "spree_variants" ON "spree_variants"."product_id" = "spree_products"."id"
AND "spree_variants"."is_master" = 't'
AND "spree_variants"."deleted_at" IS NULL
INNER JOIN "spree_prices" ON "spree_prices"."variant_id" = "spree_variants"."id"
AND "spree_prices"."deleted_at" IS NULL
WHERE "spree_products"."deleted_at" IS NULL
AND ("spree_products".deleted_at IS NULL or "spree_products".deleted_at >= '2014-09-01 07:57:37.112639')
AND ("spree_products".available_on <= '2014-09-01 07:57:37.113857')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment