List:General Discussion« Previous MessageNext Message »
From:Martijn Tonies Date:December 16 2003 2:46pm
Subject:Re: Re[2]: Comparing date fields
View as plain text  

> mysql>> select from projects
> JB>     -> where projects.closeddate between :fd and :td;
> JB> ERROR 1064: You have an error in your SQL syntax near ':fd and :td' at
> JB> line
> JB> 2
> JB> What are those colons?
> He probably uses Delphi or C++Builder to connect to mysql via TQuery
> component. TQuery has a property SQL where sql statement is stored.
> The colon ':' means that fd is a parameter whose value should be
> inserted into TQuery.SQL statement just before executing the query.
> The solution is to substitute :fd with a real value directly by accessing
> property.
> Query.SQL.Clear;
> Query.SQL.Add('select ...');
> Query.SQL.Add('where projects.closeddate between 01/01/01 and 01/01/02');
> Query.Open;

I very much doubt this works:

01 divided by 01 :-)

I guess you wanted to write:


With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Upscene Productions

Comparing date fieldsNoamn16 Dec
RE: Comparing date fieldsJay Blanchard16 Dec
RE: Comparing date fieldsNoamn16 Dec
RE: Comparing date fieldsJay Blanchard16 Dec
  • Re[2]: Comparing date fieldsDeBug16 Dec
  • Re: Re[2]: Comparing date fieldsMartijn Tonies16 Dec
RE: Re[2]: Comparing date fieldsNoamn16 Dec