B
B
blizzard2019-02-26 21:37:24
Python
blizzard, 2019-02-26 21:37:24

Why is the result of a query executed in a .py file empty, while the same query from sqlbrowser works correctly?

This is the simple code:

import sqlite3

conn = sqlite3.connect('employees.sqlite')

cursor = conn.cursor()

cursor.execute(
    "SELECT id, LastName, FirstName from employees WHERE strftime('%m',DOB) = strftime('%m','now') AND  strftime('%d','now') = strftime('%d', DOB)")

results = cursor.fetchall()
print(results)
conn.close()

results on the output is empty
The same query from the sqllite browser works fine, the result is not empty:
5c7587573f4d9371518367.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
blizzard, 2019-03-05
@s41blizzard

I seem to have confused the position of the month and day in the date.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question