db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manaster, Carl" <Ca...@ACTIVX.com>
Subject RE: Subselects in Torque 3.3rc2
Date Tue, 19 Aug 2008 16:55:05 GMT
Hi, Markus,

> Now I managed this with two criteria.addJoin();
>
> Is there a better way?

I think treating it as a regular, instead of a nested, query, makes lots
of sense (at the SQL level, independent of torque).  Just think of the
query as

select name [or perhaps DISTINCT name]
from       resource                r
inner join resource_postalcode_rel k on k.id [or perhaps k.RESOURCE_ID]
= r.id
inner join postalcode              p on p.id = k.postalcode_id
where p.city_name  like '%76%'
or    p.postalcode like '%76%'

To my eye, anyway, that's a good deal clearer than the nested selects.

Peace,
--Carl

---------------------------------------------------------------------
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