Hey all,
I'm pulling my hair out trying to learn the nuances of Access SQL for a new job and i'm not used to it. I am trying to do a nested query that should be quite simple but everything i try is a dead-end. I have a Count in the original SELECT statement which might be throwing me off. See code below. The first one runs fine, but doesn't allow me to specify for a date range. The second code is with my nested query that will not run, giving me an error stating "The SELECT statement includes a reserved word or an argument name that is misspelled, missing or the punctuation is incorrect". No matter where i move it in the query (after the FROM) it gives me errors.
SELECT tbl1.TranFacName, Count(tbl1.TranFacName) AS NumOfTransfers
FROM tbl1
WHERE tbl1.TranFacName Is Not Null
GROUP BY tbl1.TranFacName;
now the subquery:
SELECT tbl1.TranFacName, Count(tbl1.TranFacName) AS NumOfTransfers
(SELECT tbl1.ArrivalDate FROM tbl1
WHERE tbl1.ArrivalDate BETWEEN #1/1/2015# AND #12/31/2015#)
FROM tbl1
WHERE tbl1.TranFacName Is Not Null
GROUP BY tbl1.TranFacName;
I just need to be able to edit the date range for the NumOfTransfers attribute. Is there just a better way to do this entirely?
Thanks in advance!