Skip to content

Instantly share code, notes, and snippets.

@campanalbero
Created January 27, 2015 11:53
Show Gist options
  • Save campanalbero/05ddafc83aae000b1268 to your computer and use it in GitHub Desktop.
Save campanalbero/05ddafc83aae000b1268 to your computer and use it in GitHub Desktop.
sequel で where
DB = Sequel.sqlite('photo/photo.db')
photo = DB[:photo].all
for year in 2000..Date.today.year do
puts " -- " + year.to_s + " -- "
start = year.to_s + '-01-01'
end = (year + 1).to_s + '-01-01'
photo = DB[:photo].where('date_time >= ? and date_time < ?', start, end).all
puts photo
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment