Skip to content

Instantly share code, notes, and snippets.

@auxesis
Forked from skorfmann/heredoc_hash.rb
Created August 19, 2013 02:45
Show Gist options
  • Save auxesis/6265388 to your computer and use it in GitHub Desktop.
Save auxesis/6265388 to your computer and use it in GitHub Desktop.
{:default => <<-DEFAULT_SQL.strip, :mysql => <<-MYSQL.strip}
UPDATE users SET item_count = item_count + 1
WHERE id IN (SELECT user_id FROM buckets WHERE id = NEW.bucket_id)
DEFAULT_SQL
UPDATE users, buckets SET item_count = item_count + 1
WHERE users.id = user_id AND buckets.id = NEW.bucket_id
MYSQL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment