I have a massive database over over 2.7 million rows. It contains data on uk property prices.
The first Table is called PricePaid And has a column called Price and Loc4.
Now I am trying to get the average for each year grouped by loc4 and update another tabel called PricePaidByCounty.
I have created this SQL statement :
INSERT PricePaidByCounty (County, Avg2013)
SELECT Loc4,
Avg(Price) as AvgPrice2013 FROM PricePaid WHERE Date Like '%2013%'
Group BY Loc4
This works fine for inserting initial row but I want to use an update statement instead as I will need to run this SQL query each month.
Can anyone show me how to change this Insert into an update.
I am doing this as I need to quickly display average house price for each location by year. And the Database is that big I dont want to do this on the flu
Thanks