Correct me if I'm wrong (please) but in an SQL statement rather than using
GTE it should be >=

like this:

<cfif form.startyear is not "">
 and Year >=  #form.startyear#
 </cfif>
</cfquery>

Hope this helps
J
----- Original Message -----
From: Denton <[EMAIL PROTECTED]>
To: CF-Talk <[EMAIL PROTECTED]>
Sent: Tuesday, May 29, 2001 6:14 PM
Subject: <CFIF Help> - Simple SQL Question:


> Hi All,
>
> I am a CF newbie and getting the hang of it but this is giving me trouble:
>
> I have a query like this on a search action page;
>
> <cfquery name="qCar" datasource="vehicles">
>  select *
>  from Cars
>  where 0=0
>  <cfif Trim(Form.Make) is not "">
>  and Make='#form.Make#'
>  </cfif>
>  <cfif FORM.Make is not "">
>  and Make='#Form.Make#'
>  </cfif>
>  <cfif FORM.Model is not "">
>  and Model='#Form.Model#'
>  </cfif>
>  <cfif form.startyear is not "">
>  and Year GTE #form.startyear#
>  </cfif>
> </cfquery>
>
> so everything works great and displays a table
> until I add the last cfif statement.  it tells me there
> is a syntax error with 'where 0=0 and Year GTE
> 1995' (assuming form.staryear was 1995 in this
> example).  So it seems my system works great for
> the others which are text but I am doing somehting
> wrong with the startyear (which is a number)
> any help would be greatly appreciated!
>
> by the way:  it works fine if i make the last statement
> and Year = #form.startyear# but i want GTE #startyear#
>
> Thanks!
>
> -Denton
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to