This is my SQL Query
SELECT m.Bldg,
SUM(e.TotCost * SWITCH(e.Utility='E', 1, true, 0)) AS ECost,
SUM(g.TotCost * SWITCH(e.Utility='G', 1, true, 0)) AS GCost,
SUM(h.TotCost * SWITCH(e.Utility='H', 1, true, 0)) AS HCost,
SUM(c.TotCost * SWITCH(e.Utility='C', 1, true, 0)) AS CCost,
SUM(w.TotCost * SWITCH(e.Utility='W', 1, true, 0)) AS WCost,
SUM(s.TotCost * SWITCH(e.Utility='S', 1, true, 0)) AS SCost
FROM tblBldgMeters m
LEFT JOIN qryMtrHistory e ON m.EMeter=e.Meter
LEFT JOIN qryMtrHistory g ON m.GMeter=g.Meter
LEFT JOIN qryMtrHistory h ON m.HMeter=h.Meter
LEFT JOIN qryMtrHistory c ON m.CMeter=C.Meter
LEFT JOIN qryMtrHistory w ON m.WMeter=W.Meter
LEFT JOIN qryMtrHistory s ON m.SMeter=S.Meter
GROUP BY m.Bldg
I am getting this error message:
When I get out of the message, this part is highlighted "UM(e." from the very first line of the query. I think the error is that I need more parentheses around the LEFT JOINS, but I'm not sure how to format them. If anyone can help, I would appreciate it. I'm assuming Access is throwing me an error about me trying something that is legal in SQL but not in access, but I'm not sure how to fix it. Thank you!