Temporally change information in query results??

G

Guest

My query returns a group of 5 projects:
Local
Region1
Region2
Region3
International
Is there a way to change Local so that it shows in the query as Region 1. I
don’t want to change the information in my field. I am hoping that there is
a way to use and If statement or something in the Criteria that will do this
only in the query.
Thanks in Advance
 
M

MGFoster

Raj said:
My query returns a group of 5 projects:
Local
Region1
Region2
Region3
International
Is there a way to change Local so that it shows in the query as Region 1. I
don’t want to change the information in my field. I am hoping that there is
a way to use and If statement or something in the Criteria that will do this
only in the query.
Thanks in Advance

SELECT IIf(column_name="Local","Region 1",column_name) As Project,
 
G

Guest

MG,
I tried the code you provided but it is not working. I understand the frist
part of the statement but not sure where the actually change take place..
Thanks
 
M

MGFoster

Raj said:
MG,
I tried the code you provided but it is not working. I understand the frist
part of the statement but not sure where the actually change take place..
Thanks

:

Syntax on IIf() function:

IIf(<expression>, <true expression>, <false expression>)

Translation: If the <expression> evaluates to True, use the <true
expression>; otherwise, use the <false expression>.

Therefore, my example would translate to this:

If the column that holds the Local, Region1, Region2, etc., holds the
word "Local," display the words "Region 1" instead; otherwise, display
the value that is in the column. Use the alias "Project" as the column
name in the SELECT clause. Continue with the rest of the SELECT clause
and the rest of the SQL statement.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top