actually, I found the reason it was choking-- the double quotes here: FFDDTEI”LastOrdr”
are not actually double quotes. Must have been some junk from using MSWord to type the statements.
All works well now.
Another question: is it possible to use the col aliases (Sum(CASE when...
thanks, that got me pointed in the right direction. I am writing this for AS/400 SQL so it looks almost the same:
Select
FFDARCD"A/S/D",FFCCUSN"Cust#",FFCCNMB"CustNm",FFDDTEI"LastOrdDt",
FFDCDTE"CreateDt",FFDDTBC"FirstOrd", FFDDTEI”LastOrdr”,
Sum(CASE when HHHFSYR=2005 then HHHEXSN else 0 END)...
Trying to write a query to find "lost customers". Fist I want to pull 2005 YTD Sales, then sales by period in columns to the right, looks something like this:
Cust# CustName YTD05Sales Jan06Sales Feb06Sales etc
My problem is that to get the sales numbers, I have to use a where clause...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.