>I'm trying to increment a counter in a SQL statement based on a condition. I've seen the code before somewhere, but I can't find it. It's something like this:
>
>select max(iif(x>3,1,0),1) as counter ;
> from table1
>
>
>
>This code isn't right, far from it, but there was someway to increment the "counter" that I can't remember. Does anyone have any idea what I'm talking about?
Actually, I've just tried this syntax:
select *, sum(iif(seq>2,5,2)) from workfile group by functionid
and it gave me the correct result, I think.
Try this.
If it's not broken, fix it until it is.
My Blog