Skip to content

Instantly share code, notes, and snippets.

@bkmorse
Created October 17, 2014 17:00
Show Gist options
  • Save bkmorse/8b16bf0c32f20c177ae0 to your computer and use it in GitHub Desktop.
Save bkmorse/8b16bf0c32f20c177ae0 to your computer and use it in GitHub Desktop.
sql for retrieving instagram and twitter entries with url to post
select id, created_at, social_username, source,
case source
when 'TWITTER' then concat('http://twitter.com/statuses/', social_message_id)
when 'INSTAGRAM' then (select instagrams.i_link from instagrams where instagrams.i_id = sweepstakes_entries.social_message_id)
end as url
from sweepstakes_entries;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment