[Zope-DB] SQL-subselect question
Charlie Clark
charlie@begeistert.org
Thu, 21 Nov 2002 10:54:52 +0100
On 2002-11-21 at 10:04:55 [+0100], Smith, Neil (Worcester) wrote:
> If I've got it right about what you want (and I'm not sure I have), what
> about
>
> SELECT *
> FROM
> mytable mytable1,
> mytable mytable2,
> anothertable
> WHERE
> anothertable.value = 'something' AND
> mytable1.f_key = anothertable.f_key AND
> mytable2.f_key = anothertable.f_key AND
> mytable1.ext_id1 = 1 AND
> mytable2.ext_id2 = 1
>
> If it performs poorly, you might need some indexes. Indexing f_key on
> both tables would be a start, after that it depends very much on what the
> data is like as to what is best to index.
Yes, I think that should work. It seems a bit strange to have to rename the
same table over and over again to do it though which does suggest I should
use separate tables in the first place.
Thanx
Charlie