Answer the question
In order to leave comments, you need to log in
How to set a time interval in a SQL query?
This is my first job with db. I have 2 tables, I want to combine them with join and set the time interval. Here is my code:
import pyodbc
import pandas as pd
conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\logs\dataB.mdb;')
cursor = conn.cursor()
sql = "select report, change_date, user_, display_name from history INNER JOIN User_ ON history.user_=User_.id WHERE change_date between '2020/11/03 10:00:00' and '2020/12/04 22:00:00'"
df = pd.read_sql(sql, conn)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question