I am using python and mysql connector and am trying to get all eventids from the mySQL DB between two different datetime stamps.
The DB is
eventid | date | homeodds | drawodds | awayodds
This is the code:
def findarbs(startdate, enddate):
cnx = mysql.connector.connect(**dbconfig)
cur = cnx.cursor()
command = "SELECT DISTINCT eventid, date FROM moneyline
WHERE 'date' > ('%s') AND 'date' < ('%s')
ORDER BY date asc" % (startdate, enddate)
print command
cur.execute(command)
result = cur.fetchone()
print result
while result is not None:
print result[1]
result = cur.fetchone()
And the call to the method:
findarbs("2015-03-01 15:00:38", "2015-03-08 15:00:38")
Now if I change the command to:
command = "SELECT DISTINCT eventid, date FROM moneyline
WHERE 'date' > ('%s')
ORDER BY date asc" % (startdate)
it sucessfully selects the correct eventids and dates. If I change it to less than it also works. But when I try to combine them or use the BETWEEN command I get NONE back.