[Zope] DTML sql construction and IN keyword

Dieter Maurer dieter@handshake.de
Mon, 15 Jul 2002 18:29:47 +0200


Shane Landrum writes:
 > I'm writing some DTML to create a SQL query which uses the IN
 > keyword. I need to select a set of records with a particular
 > set of record IDs, like so:
 > 
 > SELECT * FROM tablename WHERE id IN (42,27,83);
 > 
 > I'm constructing the list of ids externally, so that I pass in
 > an idlist as a string: '42,27,83'.  My DTML looks something like this:
 > 
 > 'select * from tablename where id in \
 > (<dtml-sqlvar idlist type="string">)'
Please look at "sqltest" (embedded online docu).


Dieter