[Zope] multiple selects are not allowed

Ivan Cornell ivan.cornell@framestore.co.uk
Fri, 15 Dec 2000 11:02:48 +0000


>
> >Diny, why do you need to execute multiple selects in one SQL-Method?
> >
> Belief me, you don't want to know ;)
>
> I'm building a database application for the drugstore department.
> Veterinarians can find medicines by searching on animal, ingredients,
> diseases etc. When they've found one medicine all the detailed information
> about this particular medicine is being displayed. At this point i thought
> i could use the multiple selects.
> The medicine has a 1 to many relationship with animals, ingredients,
> diseases etc. all stored in different tables. When i use one single select
> statement with several where conditions, and one relationship isn't filled,
> the query returns nothing at all.
>
> >Maybe there is another way of doing it?
> >
> I'll split up one complex ZSQL method into several simple methods.
>

Without seeing your queries, I would say use sql's UNION command, eg,

SELECT name FROM animals WHERE id =21 UNION SELECT name FROM diseases WHERE id
=21;

regards, Ivan