Last active
August 16, 2016 21:36
-
-
Save knubie/376cf05bb9a0e3085fa2b19a3d4f280e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
CREATE OR REPLACE FUNCTION days_remaining(users) | |
RETURNS interval AS $$ | |
SELECT (start_date + (commitment_term * '1 month'::INTERVAL)) - current_date FROM users JOIN memberships ON ($1.id = memberships.user_id) | |
$$ STABLE LANGUAGE SQL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment