Re: Help with expression builder and IF Statements

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Gerald Stanley (gcstanley_at_d-s-l.pipex.com)
Date: 04/20/04


Date: Tue, 20 Apr 2004 03:40:51 -0700

Put your query into Design Mode thne put the following in
the nest available field column

IIf(ColumnX < 1000,ColumnX * 0.3, IIf(ColumnX < 2000,
ColumnX * 0.4, ColumnX * 0.5))

Hope This Helps
Gerald Stanley MCSD
>-----Original Message-----
>Im not really a big user of MS Access so please bear with me
>
>I have a field which contains a numerical value (ColumnX)
>
>In a new column in the query i need to take the value of
ColumnX and if the
>value is less than 1000
>i need to put 30% of ColumnX into the new column
>if its greater than 1000 and less than 2000
>i need to put 40% of ColumnX into the new column
>anc finally if its greater than 2000
>i need to put 50% of ColumnX into the new column
>
>i.e.
>
>if columnX <=1000 then
> newColumn = ColumnX*0.3
>else if ColumnX >1000 and <= 2000 then
> newColumn = ColumnX*0.4
>else if ColumnX >2000 then
> newColumn = ColumnX*0.5
>endif
>
>I have no idea how to do the above in a query, Ive looked
about on the web
>and I am unable to find anything to do with If statements
>for Querys if anyone could help with this it would be
greatly appreciated
>
>Mike Fellows
>
>
>.
>



Relevant Pages

  • Re: query enhancement
    ... The query, as it now stands, tests for the presence of 'null' in one ... select countfrom tableX where columnX IS NULL; ... Presuming you have an index this may produce an index fast full scan ...
    (comp.databases.oracle.server)
  • perl 5.8 CGI DBM Oracle and ?
    ... I need to run a basic sql, query select "5 colums" from db.table where ... columnx = 123. ...
    (perl.beginners)
  • Re: query enhancement
    ... The query, as it now stands, tests for the presence of 'null' in one ... select countfrom tableX where columnX IS NULL; ... Presuming you have an index this may produce an index fast full scan ...
    (comp.databases.oracle.server)
  • Re: query enhancement
    ... The query, as it now stands, tests for the presence of 'null' in one ... where exists (select 'x' from tableX where columnX is null); ...
    (comp.databases.oracle.server)