[Zope-DB] Z sql Method and using 'OR'

David Duncan davdunc at grandecom.net
Wed May 5 14:17:28 EDT 2004


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>?  




More information about the Zope-DB mailing list