This is sqlite3 which excludes other solutions I've read here for other SQL implementations.
I have a table "DR" which has, among other data, columns for "month" (1-12 without the zero padding) and "year" (yyyy) which are both text columns.
I want to retrieve all of the lines where the month/year are between two particular pairings, eg from year 2017 month 6 through year 2020 month 4. Those 4 values are also coming in (from python) as text with no padding on the month. I want to be sure to also handle the case of less than a full year, eg 2017 month 2 through 2017 month 10.
I figured out how to do it by brute force with an absurd number of ORs and never touching an actual date-related function, but I was wondering if there was a more elegant way to do it that took advantage of sql actually understanding a date being greater or lesser than another date with rolling month numbers across year boundaries.
Thank you for any help you can provide!
'YYYY-MM-01'
string. Lots of results searching withpython sqlite3 dates site:stackoverflow.com
– wwii