Martin Reid
mwp.reid at qub.ac.uk
Tue Mar 30 03:15:38 CST 2004
Thanks Gustav. Got it working using the uqery and the IIF Martin ----- Original Message ----- From: "Gustav Brock" <gustav at cactus.dk> To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> Sent: Tuesday, March 30, 2004 10:04 AM Subject: Re: [AccessD] SQL Question - Urgent > 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 > > -- > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >