LloydDobler
Technical User
Hi everyone, I'm trying to use a query from SQL in Access and am wondering if this is possible.
SELECT division, SUM(CASE datepart('y', [date initiated]) WHEN datepart('y', getdate()) THEN 1 ELSE 0 END) AS CHYTD,
SUM(CASE datepart('m',[date initiated]) WHEN 1 THEN containmenthrs ELSE 0 END) AS CHJAN, etc through December
I checked the help files to see if CASE can be used in Access, but it says check the SQL documentation, which leads me to believe it can, so I'm wondering if it's my syntax here?
"I don't want to sell anything, buy anything or process anything as a career. I don't want to sell anything bought or processed... or buy anything sold or processed... or process anything sold, bought or processed... or repair anything sold, bought or processed. You know, as a career, I don't want to do that."
SELECT division, SUM(CASE datepart('y', [date initiated]) WHEN datepart('y', getdate()) THEN 1 ELSE 0 END) AS CHYTD,
SUM(CASE datepart('m',[date initiated]) WHEN 1 THEN containmenthrs ELSE 0 END) AS CHJAN, etc through December
I checked the help files to see if CASE can be used in Access, but it says check the SQL documentation, which leads me to believe it can, so I'm wondering if it's my syntax here?
"I don't want to sell anything, buy anything or process anything as a career. I don't want to sell anything bought or processed... or buy anything sold or processed... or process anything sold, bought or processed... or repair anything sold, bought or processed. You know, as a career, I don't want to do that."