codefighta
Programmer
Hello,
I am using ODBC (with PEAR : DB) to connect to foxpro tables (.dbf) from my PHP app and have this in my a table
and would like to get this from my query
I am currently trying to do this with SUM and CASE but get the following error (You can see the query in [userinfo])
I am not sure how to interprete
and
Any ideas?
Thanks
cf
I am using ODBC (with PEAR : DB) to connect to foxpro tables (.dbf) from my PHP app and have this in my a table
Code:
ITEM QTY DATE
---------------------
1234 2 1/23/2004
1234 3 1/26/2004
1234 1 2/12/2004
1234 5 6/18/2004
4321 8 3/21/2004
4321 2 4/11/2004
and would like to get this from my query
Code:
ITEM JAN FEB MAR APR MAY JUN JUL ... DEC
-----------------------------------------
1234 5 1 5
4321 8 2
I am currently trying to do this with SUM and CASE but get the following error (You can see the query in [userinfo])
Code:
[error_message_prefix] =>
[mode] => 1
[level] => 1024
[code] => -29
[message] => DB Error: null value violates not-null constraint
[userinfo] => select imnum,
sum(case when extract(month from date) = 1 then qty end) as jan,
sum(case when extract(month from date) = 2 then qty end) as feb,
sum(case when extract(month from date) = 3 then qty end) as mar,
sum(case when extract(month from date) = 4 then qty end) as apr,
sum(case when extract(month from date) = 5 then qty end) as may,
sum(case when extract(month from date) = 6 then qty end) as jun,
sum(case when extract(month from date) = 7 then qty end) as jul,
sum(case when extract(month from date) = 8 then qty end) as aug,
sum(case when extract(month from date) = 9 then qty end) as sep,
sum(case when extract(month from date) = 10 then qty end) as oct,
sum(case when extract(month from date) = 11 then qty end) as nov,
sum(case when extract(month from date) = 12 then qty end) as dec
from itsar404.dbf WHERE cnum='23651' AND imnum<>'' group by imnum [nativecode=S1000 [Microsoft][ODBC Visual FoxPro Driver]Function name is missing ).]
[backtrace] => Array
I am not sure how to interprete
Code:
DB Error: null value violates not-null
Code:
[ODBC Visual FoxPro Driver]Function name is missing ).]
Any ideas?
Thanks
cf