db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Αντώνης Λεμπέσης <ant...@di.uoa.gr>
Subject query with "exists" clause
Date Fri, 17 Jun 2005 14:25:53 GMT
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