D
Dana
Help!!! and thanks in advance to anyone who can help me.
I am trying to use the switch function to evaluate various
city names and set a specific county name for them.
However, it seems I've used too many expressions because I
get #error in what should be the county column. Please
help. What other structure could I use to set the county
to a specific name if the city matches the expression?
Please give an example with at least three counties using
my example below. I am new to queries and such so I need
to take baby steps. My example:
SELECT [CLIENT].[PriCity], Sum([TRIPARCHIVE].[Clients]) AS
ADAPass, Switch([CLIENT].[PriCity] In
("Alameda","Albany","Berkeley","Emeryville","Oakland","Pied
mont"),"NORTH ALAMEDA COUNTY",[CLIENT].[PriCity] In ("San
Leandro","Hayward","Castro Valley","San Lorenzo"),"CENTRAL
ALAMEDA COUNTY",[CLIENT].[PriCity] In
("Dublin","Livermore","Pleasanton","Union
City","Fremont","Newark"),"SOUTH ALAMEDA COUNTY",[CLIENT].
[PriCity] In ("El Cerrito","El
Sobrante","Kensington","Point Richmond","Richmond","San
Pablo"),[CLIENT].[PriCity] In
("Antioch","Concord","Crockett","Danville","Hercules","Lafa
yette","Orinda","Pinole","Pittsburg","Pleasant
Hill","Rodeo"),"CONTRA COSTA COUNTY Outside Coordinated
Service Area",[CLIENT].[PriCity] In ("Daly
City","Milpitas","San Francisco","San Jose","Santa
Clara"),"CITIES OUTSIDE ALAMEDA and CONTRA COSTA
COUNTIES",True,"OTHER") AS County
FROM CLIENT LEFT JOIN TRIPARCHIVE ON [CLIENT].[Id]=
[TRIPARCHIVE].[Clientid]
WHERE ((([TRIPARCHIVE].[Status])="s"))
GROUP BY [CLIENT].[PriCity];
I am trying to use the switch function to evaluate various
city names and set a specific county name for them.
However, it seems I've used too many expressions because I
get #error in what should be the county column. Please
help. What other structure could I use to set the county
to a specific name if the city matches the expression?
Please give an example with at least three counties using
my example below. I am new to queries and such so I need
to take baby steps. My example:
SELECT [CLIENT].[PriCity], Sum([TRIPARCHIVE].[Clients]) AS
ADAPass, Switch([CLIENT].[PriCity] In
("Alameda","Albany","Berkeley","Emeryville","Oakland","Pied
mont"),"NORTH ALAMEDA COUNTY",[CLIENT].[PriCity] In ("San
Leandro","Hayward","Castro Valley","San Lorenzo"),"CENTRAL
ALAMEDA COUNTY",[CLIENT].[PriCity] In
("Dublin","Livermore","Pleasanton","Union
City","Fremont","Newark"),"SOUTH ALAMEDA COUNTY",[CLIENT].
[PriCity] In ("El Cerrito","El
Sobrante","Kensington","Point Richmond","Richmond","San
Pablo"),[CLIENT].[PriCity] In
("Antioch","Concord","Crockett","Danville","Hercules","Lafa
yette","Orinda","Pinole","Pittsburg","Pleasant
Hill","Rodeo"),"CONTRA COSTA COUNTY Outside Coordinated
Service Area",[CLIENT].[PriCity] In ("Daly
City","Milpitas","San Francisco","San Jose","Santa
Clara"),"CITIES OUTSIDE ALAMEDA and CONTRA COSTA
COUNTIES",True,"OTHER") AS County
FROM CLIENT LEFT JOIN TRIPARCHIVE ON [CLIENT].[Id]=
[TRIPARCHIVE].[Clientid]
WHERE ((([TRIPARCHIVE].[Status])="s"))
GROUP BY [CLIENT].[PriCity];