Created
February 13, 2014 17:00
-
-
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"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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