D
Dana
I want to find out how many equipment codes require a lift
vs. those that do not. I am using switch and it works
only for those conditions that are not combined with
others. For example it works for EC and codes it as Lift
but it codes EC,P,S as NoLift. How can I get the query to
recognize that EC appears anywhere in the field and to
include it in the lift category?
QUERY:
PARAMETERS [Start Date] DateTime, [End Date] DateTime;
SELECT count([TRIPARCHIVE].[TripId]) AS Trips,
[triparchive].[equipment], Switch([TRIPARCHIVE].
[Equipment] In
("PS","WC","X","EC","L","WT"),"Lift",True,"No Lift") AS
Condition
FROM CLIENT LEFT JOIN TRIPARCHIVE ON [CLIENT].[Id]=
[TRIPARCHIVE].[Clientid]
WHERE ((([TRIPARCHIVE].[Status])="s") And (([TRIPARCHIVE].
[Tripdate]) Between [start date] And [end date]) And
(([TRIPARCHIVE].[Clientid])<>3037782))
GROUP BY [triparchive].[equipment];
TABLE:
TripID Equipment
123 EC
134 EC,CN
145 EC,CN,OT
155 X
165 OX (not the same as above x)
vs. those that do not. I am using switch and it works
only for those conditions that are not combined with
others. For example it works for EC and codes it as Lift
but it codes EC,P,S as NoLift. How can I get the query to
recognize that EC appears anywhere in the field and to
include it in the lift category?
QUERY:
PARAMETERS [Start Date] DateTime, [End Date] DateTime;
SELECT count([TRIPARCHIVE].[TripId]) AS Trips,
[triparchive].[equipment], Switch([TRIPARCHIVE].
[Equipment] In
("PS","WC","X","EC","L","WT"),"Lift",True,"No Lift") AS
Condition
FROM CLIENT LEFT JOIN TRIPARCHIVE ON [CLIENT].[Id]=
[TRIPARCHIVE].[Clientid]
WHERE ((([TRIPARCHIVE].[Status])="s") And (([TRIPARCHIVE].
[Tripdate]) Between [start date] And [end date]) And
(([TRIPARCHIVE].[Clientid])<>3037782))
GROUP BY [triparchive].[equipment];
TABLE:
TripID Equipment
123 EC
134 EC,CN
145 EC,CN,OT
155 X
165 OX (not the same as above x)