Thanks for taking the time to read my question.
Imagine a situation where a customer is given a free gift if they open an account. Some ‘customers’ open an account to get the free gift, but never add any money to their account. Other ‘customers’ open accounts, get the free gift and also fund their accounts by adding money to it.
I need to compare the funded accounts to the overall count of all customers.
Things at first appeared quite easy …
SELECT Audits.AuditDate, Count(Audits.NickName) AS AllAccounts
FROM Audits
Group By Audits.AuditDate
This obviously gives me the count of all accounts on a daily basis.
To get the ‘Funded’ count, I do …
SELECT Audits.AuditDate, Count(Audits.NickName) AS Funded
FROM Audits
WHERE Audits.CurrGBP > 0
GROUP BY Audits.AuditDate;
This time I get the count of the ‘Funded’ accounts.
Now, this is where I get stuck … I want both counts from the same query so my results would be like this …
AuditDate (DD/MM/YYYY) AllAccounts Funded
01/01/2012 50 45
02/01/2012 60 50
03/01/2012 70 55
Something is telling me I need to use a Sub Query, but after googling a few pages. Sub Queries are baffling to me.
May I ask for some help please ? Can you show me how to write a Sub Query to give me the results I need.
Regards,
John.
PS – My Audits table has the following fields, Audit_ID, Audit_Date, NickName, CurrGBP and I am using MS Access 2010.
Cant remember if access supports case; or if IIF is the way to go… but something like…
A sub query isn’t really needed, you can get the results in one query, just limit what you count when using a case or IIF.
if IIF
EDIT, was missing some commas in selects.