[fpc-pascal] sqldb query error on group by with where clause

Bee bisma at brawijaya.ac.id
Fri Sep 14 20:11:02 CEST 2007


This query...

select k_province, k_city, k_school, count(file_id), sum(amt_student) from 
upload_log where (date(upload_time)='2007-09-14') group by k_province, 
k_city having k_province='205' and k_city='205031';

raises exception...

An unhandled exception occurred at $0808E144 :
EDatabaseError : Error executing query: You have an error in your SQL 
syntax; check the manual that corresponds to your MySQL server version for 
the right syntax to use near 'group by k_province, k_city having 
k_province='205' and k_city='205031';)' at line 1

tested on sqldb using tmysql50connection class on FPC 2.0.2, Ubuntu Feisty, 
mySQL 5.0.

The weird thing is... the same exact query is run fine when executed through 
mysql's console or mysql query browser or phpmyadmin or any other mysql 
client programs. Only sqldb that refused to run the query. If I remove the 
where clause (no date check), the query would run fine. That's why it 
confused me since I don't know what's wrong with it.

Any hints? Or is it sqldb's bug? TIA.

-Bee-

has Bee.ography at:
http://beeography.wordpress.com




More information about the fpc-pascal mailing list