[Zope] ZSQL "OR" search help

Joel Burton jburton@scw.org
Mon, 16 Jul 2001 20:58:52 -0400 (EDT)


On Sun, 15 Jul 2001, Fabrizio wrote:

> Hello,
> 
> How can I perform a "OR" search on a SQL database field using a web form ?
> 
> 
> E.g. :
> 
> I have a SQL database table with fields "name", "surname" and the following
> records:
> 
> 
> Jimmy    Carter
> Ronald    Reagan
> George   Bush
> Bill           Clinton
> 
> I would like to search the "name" field through a web form and write :
> 
> George OR Jimmy
> 
> 
> And it should return :
> 
> Jimmy      Carter
> George    Bush

Your question is a bit vague. What kind of web form do you have?

A good general hint would be the SQL IN() syntax:

  WHERE firstname IN ('Jimmy','George')

which could be in the ZSQL Method as a sequence over a list.

-- 
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington