[AccessD] Where claise in IIf query

Andy Lacey andy at minstersystems.co.uk
Mon Nov 10 13:03:45 CST 2003


Oleg
You can't refer to an expression's name in the WHERE clause. Best way is to
create a little function (or two in this case). You can then refer to the
function's return value in the SELECT and WHERE clauses.

Andy Lacey
http://www.minstersystems.co.uk 

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
> Oleg_123 at xuppa.com
> Sent: 10 November 2003 18:43
> To: accessd at databaseadvisors.com
> Subject: [AccessD] Where claise in IIf query
> 
> 
> Hey Group, I am not able to put conditions in queries whee I 
> use IIF. What is the alternate solution ? This works ---
> 
> SELECT Table3.amount,
> IIf([Amount]="4 ","777",IIf([Amount]="2 ","060010",IIf([Amount="3
> ","055"))) AS HH,
> IIf([HH]="060010 ","zzz",IIf([HH]="777 ","yyy")) AS JJ
> FROM Table3;
> 
> however when  Iput in WHERE
> 
> SELECT Table3.amount,
> IIf([Amount]="4 ","777",IIf([Amount]="2 ","060010",IIf([Amount="3
> ","055"))) AS HH,
> IIf([HH]="060010 ","zzz",IIf([HH]="777 ","yyy")) AS JJ
> FROM Table3
> WHERE JJ = "zzz"
> 
> doesn't work. I tried inserting GROUP BY by all statements, 
> and then HAVING, but doesn't work either...
> 
> 
> -----------------------------------------
> Get Breaking News from CNN, ABC, NBC, CBS Now. 
> http://www.xuppa.com/news/?link=webmail
> 
> 
> 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/a> ccessd
> Website: 
> http://www.databaseadvisors.com
> 
> 




More information about the AccessD mailing list