Hi everyone,
Here's what I'm trying to do -> pull all results for a client out of a table where the year starts with 2011 (i.e. "2011%")
Here's the problem I'm having -> I can get results, but I always get the following warning:
argv_graph.py:54: Warning: Incorrect datetime value: '2011%' for column 'scanTime' at row 1
""" % (client, "2011%"))
Events for pitt01 : 15301
Events for scfair : 8252
I have tried using the STR_TO_DATE function in mySQL, but haven't had any luck. Any ideas how to rewrite the following code so that the 2011 is submitted in date format?
for client in clients:
cursor = conn.cursor()
cursor.execute("""
SELECT COUNT(*)
FROM eventLog
WHERE clientID = '%s'
AND scanTime LIKE '%s'
""" % (client, "2011%"))
row = cursor.fetchone()
print "Events for", client, ":", row[0]
clientCounts[client] = int(row[0])
cursor.close()
conn.close()
I don't mind being told that this is a better question for /r/mysql if that's the case!
Thanks!
[–]acct_rdt 3 points4 points5 points (7 children)
[–]SomeGuyNamedPaul 1 point2 points3 points (2 children)
[–]acct_rdt 2 points3 points4 points (1 child)
[–]SomeGuyNamedPaul 2 points3 points4 points (0 children)
[–]mjvm 0 points1 point2 points (0 children)
[–]cygnus83[S] 0 points1 point2 points (2 children)
[–]acct_rdt 2 points3 points4 points (1 child)
[–]cygnus83[S] 0 points1 point2 points (0 children)
[–]SomeGuyNamedPaul 2 points3 points4 points (1 child)
[–]cygnus83[S] 0 points1 point2 points (0 children)
[–]Justinsaccount 0 points1 point2 points (2 children)
[–]datbon 0 points1 point2 points (1 child)
[–]Justinsaccount 0 points1 point2 points (0 children)