I have this select statement in SQL Server Management Studio 2014:
SELECT main.car_descr
,vari.engineCode
,count(*) over(partition by vari.engineCode) as quant
FROM dbspareparts.dbo.stock as stock
inner join fiord.dbo.store as main on stock.[id_store]=main.[id_store]
where quant>2
order by quant desc
when I execute, I get "invalid column name" on the istruction
where quant>2
Why and how can I get this work?
I need to use the count(*) over(...) statement, cause this is only a piece of another longer query.
Thanks!