Skip to content

Instantly share code, notes, and snippets.

@aaronroberson
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronroberson/7a8e6584e204c9ac5ee2 to your computer and use it in GitHub Desktop.
Save aaronroberson/7a8e6584e204c9ac5ee2 to your computer and use it in GitHub Desktop.
Update pledge
# REPLACE THE BRACKETS WITH THE APPROPRIATE VALUES
# For example, WHERE user.email = '[the email address]'
# becomes WHERE user.email = 'aaron@blaremedia.net'
# This SELECT query returns the email, pledge and pledge id
# for the user. You will use the pledge id returned from this
# query to update the pledge in the UPDATE query below
SELECT user.email, pledge.pledge, pledge.id
FROM `jos_users` as user
INNER JOIN `jos_ibike_rider` as rider
ON user.id = rider.user_id
INNER JOIN `jos_ibike_pledge` as pledge
ON rider.id = pledge.rider_id
WHERE user.email = '[the email address]'
AND pledge.for_year = 2014
#This will update the pledge
UPDATE `jos_ibike_pledge` as pledge
SET pledge.pledge = [desired pledge amount]
WHERE pledge.id = [pledge id from previous query]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment