I am trying to write XLSX from an SQLite table with a WHERE clause between two selected dates.
Below is my example:
search_from = "19-09-2020"
search_to = "19-10-2020"
conn=sqlite3.connect('project.db')
writer = pd.ExcelWriter("data.xlsx", engine='xlsxwriter')
data = "SELECT Pro_ID, Pro_Name, Pro_City FROM table WHERE `Started_Date` >= ? and `Started_Date` <= ?"
df_data = pd.read_sql(data, conn, params=(search_from, search_to))
df_data.to_excel(writer, sheet_name="Data")
It is selecting data if search_date and started_date are the same month, but not if they are in different months.