De ce ai vrea coloana 4 daca tu o dai ca parametru de input?
select column4, case when count(column1) =0 then 0 else sum(valoare) end as 'test'
from table1
where column3 = 0
and data <= '2007-09-30'
and column4 = 145214
Poti sa inlocuiesti column4 cu valoarea ei:
select 145214 as column4, case when count(column1) =0 then 0 else sum(valoare) end as 'test'
from table1
where column3 = 0
and data <= '2007-09-30'
and column4 = 145214