Re: DECODE equivalent
From: Anne Nolan (anne.nolan_at_NOSPAMnuvotec.NOSPAMcom)
Date: 04/29/04
- Next message: CJ: "Help with SQL Syntax"
- Previous message: Joan Wild: "Re: Crosstab error"
- In reply to: patricia: "DECODE equivalent"
- Next in thread: MGFoster: "Re: DECODE equivalent"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 29 Apr 2004 11:24:10 -0700
The closest built-in Access function for your problem would be a bunch of
nested IIF calls.
For a more readable/maintainable solution, write a VBA function that returns
your letter code, given the state, and use that function in your query.
Anne
"patricia" <anonymous@discussions.microsoft.com> wrote in message
news:600a01c42e10$9db05530$a401280a@phx.gbl...
> I am using Microsoft Access 2000 and want to do a group
> by, but need to consolidate values in the column.
> e.g. 'A' means STATE = NY or NJ; 'B' means STATE =
> CT; 'C' for all other states.
>
> Is there a function similar to Oracle's DECODE? e.g.,
> SELECT DECODE(STATE, 'NY', 'A', 'NJ', 'A', 'CT', '2', '3')
>
> Where could I find a list of valid FUNCTIONS (SQL, not
> WORK***). Just fishing around I find ones that work
> (like STR), but cannot find any details in Microsoft
> Access Help. Thank You!
- Next message: CJ: "Help with SQL Syntax"
- Previous message: Joan Wild: "Re: Crosstab error"
- In reply to: patricia: "DECODE equivalent"
- Next in thread: MGFoster: "Re: DECODE equivalent"
- Messages sorted by: [ date ] [ thread ]