Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Incorrect column expression

Hi,

I get the following error
Incorrect column expression: 'sum(case when month(acc_Date)=1 then 1 else 0
end)'.
When I try and run the following SQL in excel 'Get External Data' - however
when run directly in SQL Server it works fine.
Any ideas about what could be wrong?
SELECT
dept,
Jan = sum(case when month(acc_Date)=1 then 1 else 0 end),
Feb = sum(case when month(acc_Date)=2 then 1 else 0 end),
Mar = sum(case when month(acc_Date)=3 then 1 else 0 end),
Apr = sum(case when month(acc_Date)=4 then 1 else 0 end),
May = sum(case when month(acc_Date)=5 then 1 else 0 end),
Jun = sum(case when month(acc_Date)=6 then 1 else 0 end),
Jul = sum(case when month(acc_Date)=7 then 1 else 0 end),
Aug = sum(case when month(acc_Date)=8 then 1 else 0 end),
Sep = sum(case when month(acc_Date)=9 then 1 else 0 end),
Oct = sum(case when month(acc_Date)=10 then 1 else 0 end),
Nov = sum(case when month(acc_Date)=11 then 1 else 0 end),
Dec = sum(case when month(acc_Date)=12 then 1 else 0 end)
FROM incident
WHERE (acc_date BETWEEN '01-01-2004' AND '31-12-2004')
GROUP BY dept


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Column sum incorrect upon subtracting Drew Excel Discussion (Misc queries) 4 November 23rd 09 10:22 PM
Incorrect Data Labels on Column Chart SM Charts and Charting in Excel 0 June 7th 06 04:39 PM
Excel column sumif is incorrect Joseph Peralta Excel Discussion (Misc queries) 5 May 25th 06 06:39 PM
need help with expression Peterpunkin Excel Discussion (Misc queries) 5 May 4th 06 05:56 PM
Expression gudway New Users to Excel 3 May 4th 06 01:12 PM


All times are GMT +1. The time now is 07:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"