alternate to IIF in query in ADP project

  • Thread starter Thread starter resetka
  • Start date Start date
R

resetka

Hallo

I need create new filed as quotient of two fields but I do not have
guarantee that, there are not be dividing by zero. Usually in mdb I use IIF
and run this operation only in rows where was possible. I need something
similar do in adp project connected to SQL. I find out that function CASE
should be useful, but do not find right way how to use it. Please note that
I am not SQL expert.

Thanks very much.

Miruna
 
resetka said:
Hallo

I need create new filed as quotient of two fields but I do not have
guarantee that, there are not be dividing by zero. Usually in mdb I use IIF
and run this operation only in rows where was possible. I need something
similar do in adp project connected to SQL. I find out that function CASE
should be useful, but do not find right way how to use it. Please note that
I am not SQL expert.

SELECT SomeField, SomeOtherField,

CASE SomeThirdField
WHEN 0 THEN 0
ELSE SomeFourthField/SomeThirdField
END AS CalculatedField

FROM SomeTable
 
Back
Top