Skip to content

Instantly share code, notes, and snippets.

@matthewpoer
Created February 13, 2014 17:00
Show Gist options
  • Save matthewpoer/8979133 to your computer and use it in GitHub Desktop.
Save matthewpoer/8979133 to your computer and use it in GitHub Desktop.
MySQL where clauses to help isolate records (e.g. invoices) "last year to date"
-- where syntax to help count up records (e.g. invoices) from last year to date
and date_field > concat(cast(extract(year from subdate(now(),365)) as char),'-01-01')
and date_field < subdate(now(),365)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment