LongFeiFengWu
Technical User
Code:
ThisYear = Year(Now())
SQL = "SELECT "
SQL = SQL & "[JAN]=SUM(CASE [EntryMonth] WHEN '1' THEN [Instance] END), "
SQL = SQL & "[FEB]=SUM(CASE [EntryMonth] WHEN '2' THEN [Instance] END), "
SQL = SQL & "[MAR]=SUM(CASE [EntryMonth] WHEN '3' THEN [Instance] END), "
SQL = SQL & "[APR]=SUM(CASE [EntryMonth] WHEN '4' THEN [Instance] END), "
SQL = SQL & "[MAY]=SUM(CASE [EntryMonth] WHEN '5' THEN [Instance] END), "
SQL = SQL & "[JUN]=SUM(CASE [EntryMonth] WHEN '6' THEN [Instance] END), "
SQL = SQL & "[JUL]=SUM(CASE [EntryMonth] WHEN '7' THEN [Instance] END), "
SQL = SQL & "[AUG]=SUM(CASE [EntryMonth] WHEN '8' THEN [Instance] END), "
SQL = SQL & "[SEP]=SUM(CASE [EntryMonth] WHEN '9' THEN [Instance] END), "
SQL = SQL & "[OCT]=SUM(CASE [EntryMonth] WHEN '10' THEN [Instance] END), "
SQL = SQL & "[NOV]=SUM(CASE [EntryMonth] WHEN '11' THEN [Instance] END), "
SQL = SQL & "[DEC]=SUM(CASE [EntryMonth] WHEN '12' THEN [Instance] END), "
SQL = SQL & "system,EntryYear FROM Outage "
SQL = SQL & "WHERE EntryYear = '"& ThisYear &"' "
SQL = SQL & "GROUP BY system"
objrec.open SQL,objcon,3,3
Syntax error (missing operator) in query expression '[JAN]=SUM(CASE [EntryMonth] WHEN '1' THEN [Instance] END)'.
Any help is greatly appreciated. I have no idea what I'm missing.
"If nothing within you stays rigid, outward things will disclose themselves. Moving, be like water. Still, be like a mirror. Respond like an echo." ~ Bruce Lee