A
ainese
ESN | Subscriber Type | Service Type
123 | Activation | Basic
123 | Activation | Tracking
123 | Activation | Data Push
234 | Renewal | Basic
234 | Renewal | Tracking
234 | Renewal | Data Push
345 | Activation | Basic
567 | Activation | Basic
567 | Activation | Tracking
678 | Renewal | Basic
678 | Renewal | Data Push
789 | Activation | Basic
789 | Activation | Tracking
This is an example of my data that I have imported from Excel. What I
am having alot of difficulty with is that I'm trying to write a query
that counts ESN where Service Type is only = 'Basic' and nothing
else.
So from the above data I should get 1. But I am getting 2 with my
coding. Please see below
Can anyone advise how to code this query in MS Access please?
This is what I've got to date but it is not working out correctly...
SELECT DISTINCT (Count(F.ESN)) AS ["Basic Activations"]
FROM Data
AS F INNER JOIN Data AS G ON F.ESN = G.ESN
WHERE (((G.ESN) Not In (SELECT ESN FROM Data WHERE SERVICE =
'Tracking')) AND ((F.SERVICE)="Basic") AND ((G.SERVICE)<>"Data Push")
AND ((G.SUBSCR_TYPE)="Service Activation"));
PLEASE HELP me as I am pulling my hair out at this stage.....
Thank you in advance,
Aine
123 | Activation | Basic
123 | Activation | Tracking
123 | Activation | Data Push
234 | Renewal | Basic
234 | Renewal | Tracking
234 | Renewal | Data Push
345 | Activation | Basic
567 | Activation | Basic
567 | Activation | Tracking
678 | Renewal | Basic
678 | Renewal | Data Push
789 | Activation | Basic
789 | Activation | Tracking
This is an example of my data that I have imported from Excel. What I
am having alot of difficulty with is that I'm trying to write a query
that counts ESN where Service Type is only = 'Basic' and nothing
else.
So from the above data I should get 1. But I am getting 2 with my
coding. Please see below
Can anyone advise how to code this query in MS Access please?
This is what I've got to date but it is not working out correctly...
SELECT DISTINCT (Count(F.ESN)) AS ["Basic Activations"]
FROM Data
AS F INNER JOIN Data AS G ON F.ESN = G.ESN
WHERE (((G.ESN) Not In (SELECT ESN FROM Data WHERE SERVICE =
'Tracking')) AND ((F.SERVICE)="Basic") AND ((G.SERVICE)<>"Data Push")
AND ((G.SUBSCR_TYPE)="Service Activation"));
PLEASE HELP me as I am pulling my hair out at this stage.....
Thank you in advance,
Aine