I'm getting different results with what I understand to be the same query from two different interfaces. The first is a mysql shell:
mysql> select * from table where sub_date > '2012-11-08' order by sub_date asc limit 1\G
*************************** 1. row ***************************
id: **176041922**
The second is a little function I put together to test a query that would pull a certain amount of records based on the datetime field "sub_date":
>>> r_query('>', '2012-11-08', '1')
((**18393664L**, 3, .....)
Here's the python module:
import MySQLdb
myuser = MySQLdb.connect(host='localhost', user='myuser', passwd='mypass', db='mydatabase')
cur = myuser.cursor()
def r_query(oper, date, limit):
cur.execute("""select * from table where sub_date %s %s order by sub_date asc limit %s""" % (oper, date, limit))
result = cur.fetchall()
print result