I have a query that I can successfully execute from a Windows command prompt, and from the FireFox SQLite Manager (v0.5.9)
SELECT CASE WHEN substr(substr(eTimeStart,1,2),-1) =':' THEN substr(eTimeStart,1,1)||substr(etimeStart,3,2) ELSE substr(eTimeStart,1,2)||substr(eTimeStart,4,2) END as aTIME FROM EVENTS WHERE Cast(eMonth as int)= 2 AND CAST(eYear as INT)=2010 and CAST(eDay as INT)=13 ORDER BY substr(eTimeStart,length(etimeStart),-2), CAST(aTIME as INTEGER) (eTimeStart is a TEXT field with values like 7:30 am and 10:15 pm) This runs flawlessly from the sqlite3 command prompt and from the Firefox SQLite Manager. All of my other Selects, Updates, Creates, Deletes run fine from PHP, but I cannot get this query to execute. Here's the exact line from the PHP code that sets the query string: $strQuery ="SELECT CASE WHEN substr(substr(eTimeStart,1,2),-1) =':' THEN substr(eTimeStart,1,1)||substr(etimeStart,3,2) ELSE substr(eTimeStart,1,2)||substr(eTimeStart,4,2) END as aTIME FROM EVENTS WHERE Cast(eMonth as int)= 2 AND CAST(eYear as INT)=2010 and CAST(eDay as INT)=13 ORDER BY substr(eTimeStart,length(etimeStart),-2), CAST(aTIME as INTEGER)"; Thanks in advance for any assistance. Rush A. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users