[AccessD] Replacement for IIf() (was: Query tuning inAccess?)

Charlotte Foust cfoust at infostatsystems.com
Thu Feb 24 14:52:13 CST 2005


I didn't say they were fast, only faster than Iif.

Charlotte Foust


-----Original Message-----
From: Gustav Brock [mailto:Gustav at cactus.dk] 
Sent: Thursday, February 24, 2005 9:20 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Replacement for IIf() (was: Query tuning
inAccess?)


Hi Charlotte et all

Really? I thought these functions were quite slow.

Anyway, here's a method to add only positives in a query.
Using IIf() it would be:

  SELECT
    IIF(F1>0,F1,0)+IIF(F2>0,F2,0)+..+IIF(Fn>0,Fn,0) AS SumPositives

This can be replaced with native SQL code:

  SELECT
    (ABS(F1)+F1+ABS(F2)+F2+..ABS(Fn)+Fn)/2 AS SumPositives

/gustav

>>> cfoust at infostatsystems.com 24-02-2005 17:18:28 >>>
Choose() and Switch() are both faster than Iif.

Charlotte Foust


-----Original Message-----
From: Sad Der [mailto:accessd666 at yahoo.com] 
Sent: Thursday, February 24, 2005 1:07 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Query tuning in Access?


Erwin,

thnx for you're response. it is a very detailled list!
One question:
I know IFF() is very slow. But what can I do to
replace them?

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list