try

SELECT * FROM news_pr
Where
(Headline like '%#var1#%' or BodyText like '%#var2#%' or tagline like
'%#var3#%')
and pr_status='Active'
<cfif len(form.pubDate)>
and Year(pr_date) = '#FORM.pubDATE#'
</cfif>
order by pr_date desc

Joe
  -----Original Message-----
  From: Les Mizzell [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, August 17, 2004 11:43 PM
  To: CF-Talk
  Subject: One More Stupid Query Question

  Here's what I'm using...

  SELECT * FROM news_pr
  Where Headline like '%#var1#%'
  or BodyText like '%#var2#%'
  or tagline like '%#var3#%'
  and pr_status='Active'
  and Year(pr_date) = #FORM.pubDATE#
  order by pr_date desc

  However, if I enter "1998" in the form, it's still returning results
  from other years...

  So, what's wrong with this? It should return records if any of the first
  three variables are are found, but ONLY where the year is 1998 and the
  status is "Active".

  Year(pr_date) refers to a smalldatetime SQL Server field....

  --
  Les Mizzell
  -------------------------------------------------------
  A vanta as márë órelyar! Nai eleni siluvar antalyannar!
  -------------------------------------------------------
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to