Skip to content

Instantly share code, notes, and snippets.

@oliyoung
Created December 2, 2011 00:12
Show Gist options
  • Save oliyoung/1420891 to your computer and use it in GitHub Desktop.
Save oliyoung/1420891 to your computer and use it in GitHub Desktop.
Competition selection query
select concat(users.first_name, ' ', users.last_name) as 'name', users.postcode, convert_tz(entries.created_at, '-08:00', '+10:30') as 'entered at'
from entries
left join users on users.id = entries.user_id
where convert_tz(entries.created_at, '-08:00', '+10:30') > '2011-08-14'
and convert_tz(entries.created_at, '-08:00', '+10:30') < '2011-12-01'
and users.is_admin = 0
and users.email not like '%qwoff%'
and users.email not like '%winecru%'
and users.email not like '%vinomofo%'
order by rand()
limit 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment