[Zope-DB] Z sql Method and using 'OR'
    Laura McCord 
    Laura.McCord at doucet-austin.com
       
    Wed May  5 15:41:12 EDT 2004
    
    
  
hmmm.... I didn't even know <dtml-or> existed. I will go check it out. I
have a couple of zope books and I was trying one particular example but
no such luck. 
 Yeah, I want some of the input fields to be optional and not effect the
the query if some of them are blank. So that is what my current dilemna
is. I thought everything was working perfectly until I thoroughly tested
it. 
Thanks for the tip.
 -Laura
-----Original Message-----
From: zope-db-bounces at zope.org [mailto:zope-db-bounces at zope.org] On
Behalf Of David Duncan
Sent: Wednesday, May 05, 2004 1:17 PM
To: zope-db at zope.org
Subject: Re: [Zope-DB] Z sql Method and using 'OR'
On Wed, 2004-05-05 at 15:00, Laura McCord wrote:
> I wrote a sql method and the OR is not really working. I want to be 
> able to either search for a user by name or search by location. But 
> the way it is now is if I only enter a name such as 'Jill' in the name
> field and click search. The query ends up searching for anyone whose 
> name is 'Jill' and anyone with NULL in the office field.
> 
> What am I doing wrong because now I can see why I am getting that 
> error but unsure how to revise my query.
> 
> select * from users
> where
> (username = '<dtml-var name="username" sql_quote>' OR useroffice = 
> '<dtml-var name="useroffice" sql_quote>')
> 
> -Laura
Why not use a <dtml-sqlgroup>  with a <dtml-or>?  
_______________________________________________
Zope-DB mailing list
Zope-DB at zope.org
http://mail.zope.org/mailman/listinfo/zope-db
    
    
More information about the Zope-DB
mailing list