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...
View Articlecase inside having
NO!! CASE is an expression. Expressions return scalar values. Columns are not fields. We do not use BIT flags in SQL. These are not little mistakes; these are fundamental misconceptions. Your whole...
View Articlecase inside having
Hihttp://www.sqlteam.com/forums/topic.asp?TOPIC_ID=10022Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members...
View Articlecase inside having
SELECT field1,field2,SUM(field3) FROM tblMain GROUP BY field1, field2 HAVING ((CASE WHEN @param=1 THEN SUM(field3) ELSE 0.2 END) > 0.1)Narsimha
View Articlecase 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...
View Articlecase inside having
perhaps a having clause like this:having @param <> 1 or @param is null or @sum(field3) > 0.1 There is an error, try it and you will see. I want to do something like: If (@param = 1) then do...
View Articlecase inside having
perhaps a having clause like this:having @param <> 1 or @param is null or @sum(field3) > 0.1Here is an example:declare @param int; set @param = 1; declare @test table(a char(1), x decimal(5,1)...
View Articlecase inside having
Hi, Is it possible to place case inside having clause? for example: select field1, field2, sum(field3) from tblMain group by field1, field2 having sum(field3) > 0.1I would like to do something like:...
View Article