Gustav Brock
gustav at cactus.dk
Tue Mar 30 03:04:09 CST 2004
Hi Martin > Has to be done in SQL if possible as they want to use it as the criteria in > a query > Need to work out the following using SQL > If D1 > D2 or D1 = D2 Then > TM= A+B+C1+D1 > Else > TM= A+B+C1+D2 That could be: TM: A + B + C1 + IIf(D1 >= D2, D1, D2) or: TM: A + B + C1 + (ABS(D1 >= D2) * D1) + (ABS(D1 < D2) * D2) > Next One is > A+B+ Higher of (C1+D1) OR (C2+D2) How about: X: A + B + IIf((C1 + D1) > (C2 + D2), C1 + D1, C2 + D2) or using ABS() as above. /gustav