Quantcast
Viewing all articles
Browse latest Browse all 8

case inside having

In this case

declare @param int; set @param = 0;
declare @test table(a char(1), x decimal(5,1) );
insert into @test values('1', 0.1), ('2',0.8), ('2',100)
;
select a
from @test
group by a
having (@param = 1 and sum(x) > 0.1) or (@param <> 1) ;



For every expert, there is an equal and opposite expert. - Becker's Law


My blog


Thank you

Viewing all articles
Browse latest Browse all 8

Trending Articles