[Zope] Linking two tables

Arpad Kiss sekter@mail.matav.hu
Fri, 19 Nov 1999 15:36:00 +0100


----- Original Message -----
From: Anders Gaarsdal Holst <anders@colorweb.dk>
To: <zope@zope.org>
Sent: Friday, November 19, 1999 2:49 PM
Subject: [Zope] Linking two tables


>
> This question might be slightly off topic. But anywhere here it is:
>
> I have two tables in my MS Access database:
> 1. Containg a record for each employee
>
> 2. DVD database containing a record for each DVD
>
> What I would like to do with Zope, is to somehow link these two
> together, so that I can write on my intranet that  Mr. X has DVD this
> and that.
>
> My problem is that I can offcause make a field in the first table
> (employee table), where I list the IDnumbers of the DVDs (seperated by
> commas), which the employee owns, but then a query returns these id's
> comma seperated and I don't how to handle this (in a <dtml-in> -loop).
>

This is not too nice solution. It would be better if you cretaed a third
table(let's say owned) with two fields:
-employeeid
-dvdid
Then with the next select you can query the dvds owned by an employee:
select dvds.* from owned, dvds where dvds.id=owned.dvdid and
owned.employeeid=<id of the given employee>
In Zope try to add a Z Search Interface. It generates the basic documents
for you. You can customize them if it is not enough for you.

Arpad Kiss