I'm using Python34 working with a MySQL database that has a table with a sent_time and delivered_time column. I am trying to get all the orders that fall between two datetime inputs but I'm only getting the script to look at sent_time and not both sent_time and delivered_time.
So in other words, I'm looking to find all the objects that were sent, in process of being delivered or delivered within a given timeframe.
query = (
"SELECT sent_time, delivered_time, OBJ, id1, id2 FROM table1 "
"WHERE sent_time BETWEEN %s AND %s"
)
userIn = dateutil.parser.parse(input('start date:'))
userEnd = dateutil.parser.parse(input('end date:'))
I tried changing the query to be WHERE sent_time or delivered_time BETWEEN %S AND %s but that just returns the entire table.
Any suggestions?