I've hit a little snag with one of my queries. I'm throwing together a simple chart to plot a number of reports being submitted by day of week.
My query to start was :
  SELECT Weekday(incidentdate) AS dayOfWeek
, Count(*) AS NumberOfIncidents
   FROM Incident
    GROUP BY Weekday(incidentdate);
This works fine and returns what I want, something like
   1      200
   2     323
   3     32
   4     322
   5     272
   6     282
   7     190
The problem is, I want the number returned by the weekday function to read the corresponding day of week, like case when 1 then 'sunday' and so forth. Since Access doesn;t have the SQL server equivalent that returns it as the word for the weekday, I have to work around.
Problem is, it's not coming out the way I want. So I wrote it using iif since I can't use CASE. The problem is, since each iif statement is treated like a column selection (the way I'm writing it), my data comes out unusable, like this
  SELECT 
 iif(weekday(incidentdate) =1,'Sunday'),
 iif(weekday(incidentdate) =2,'Monday')
 'so forth
, Count(*) AS NumberOfIncidents
  FROM tblIncident
   GROUP BY Weekday(incidentdate);
  Expr1000  Expr1001    count   
  Sunday              20
           Monday      106
                      120
                      186
                      182
                      164
                       24
Of course, I want my weekdays to be in the same column as the original query. Halp pls