Link to home
Start Free TrialLog in
Avatar of Stefan Motz
Stefan MotzFlag for United States of America

asked on

SQL Query

I'm trying to display the number of Compliments by month but I get the "Expected end of statement" error message.
I would appreciate your help:
i=1

do while i<=12
    sql2013 = "SELECT Count(ID) AS CountID FROM Compliments where year("OccDate")='2013' and month("OccDate")=i"
    Set rs2013 = conn.Execute(sql2013)

    compliments= rs2013("CountID")
    response.write MonthName(i) & rs2013("CountID")
    i=i+1

loop


j=1

do while j<=12
    sql2014 = "SELECT Count(ID) AS CountID FROM Compliments where year("OccDate")='2014' and month("OccDate")=j"
    Set rs2014 = conn.Execute(sql2014)

    compliments= rs2014("CountID")
    response.write MonthName(i) & rs2014("CountID")
    j=j+1

loop

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Shaun Kline
Shaun Kline
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Stefan Motz

ASKER

Thank you very much; problem solved!