i want to create a view for the select query:
select datepart(yy, watch_date) as jaar, sum(price) as totaleOmzet
FROM Watchhistory
GROUP BY datepart(yy, watch_date)
ORDER BY jaar
Im using Microsoft SQL server Management Studio
The code to create a view what i made was:
CREATE VIEW vShowingYear (jaar, watch_date, price, totaleOmzet)
AS
select datepart(yy, watch_date) as jaar, sum(price) as totaleOmzet
FROM Watchhistory
GROUP BY datepart(yy, watch_date)
ORDER BY jaar
But the code gave an ERROR...
Has anybody a idea?