I am trying to work on a project which is available on Youtube.
https://www.youtube.com/watch?v=8rO7ztF4NtU&t=254s&ab_channel=AlexTheAnalyst
But instead of using sqlserver i am doing it on sqlite3 and facing minor challenges.
This query is not working
q7= """UPDATE a.[mytable]
SET PropertyAddress = IFNULL(a.PropertyAddress,b.PropertyAddress)
From mytable AS a
Join mytable AS b
ON a.ParcelID = b.ParcelID
AND a.[UniqueID ] <> b.[UniqueID ]
WHERE a.PropertyAddress IS NULL"""
df = pd.read_sql_query(q7,connection)
df
=======================================
Error:
DatabaseError: Execution failed on sql 'UPDATE a
SET PropertyAddress = IFNULL(a.PropertyAddress,b.PropertyAddress)
From mytable AS a
Join mytable AS b
ON a.ParcelID = b.ParcelID
AND a.[UniqueID ] <> b.[UniqueID ]
WHERE a.PropertyAddress IS NULL': no such table: a
Top comments (2)
hey,
what are the
a.[mytable]
anda.[UniqueID]
andb.[UniqueID]
?i think these are not valid sqllite syntax.
also you have an error at the end:
no such table: a
i highly recommand that use a database manager app and run your query before you using it in your python code.
a free DB manger:
dbeaver.io/download/