db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: query with "exists" clause
Date Fri, 17 Jun 2005 14:47:56 GMT




Hi,

subselects are not supported out of the box in Torque. there are various
threads in the user mailing list of how they can be implemented, the last
one should be only a few weeks ago. Please search the archives. The
solution involves Criteria.CUSTOM, but I cannot remember exactly how it
works.

      Thomas

Αντώνης Λεμπέσης <antleb@di.uoa.gr> schrieb am 17.06.2005 16:25:53:

> Hello,
>
> I have these two tables:
>     doc(id, title) and
>     rel(source, target) (both 'source' and 'target' are foreign keys to
> doc.id)
>
> I want to form the following query, using Criteria:
>
> SELECT d1.title
> FROM doc d1
> WHERE EXISTS (
>     SELECT *
>     FROM doc d2, rel r
>     WHERE r.source = d1.id AND r.target = d2.id AND d2.title = 'foo')
>
> Any ideas on how to do this???
>
> Thanks,
> Antonis
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
Mime
View raw message