You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Mike Kienenberger <mk...@gmail.com> on 2006/05/10 20:59:02 UTC

non-SQL query to find distinct relationships in an entity's table?

I'm building a search panel, and I want to populate one of the search
criteria fields with the distinct list of values in the table being
searched.

Basically, the DataObject results returned from:

select * from OTHER_TABLE
    where OTHER_TABLE_PK in
        (select distinct(OTHER_TABLE_FK) from SEARCHED_TABLE)

Is there a way to do this other than using SQL Template?

RE: non-SQL query to find distinct relationships in an entity's table?

Posted by "Gentry, Michael (Contractor)" <mi...@fanniemae.com>.
I guess I was curious if your expression could be done without the inner
select/etc, but I didn't look at it too carefully (and obviously don't
know your business logic/schema).  Sometimes SQLTemplate is a Good
Thing.  :-)

/dev/mrg


-----Original Message-----
From: Mike Kienenberger [mailto:mkienenb@gmail.com] 
Sent: Tuesday, May 16, 2006 2:02 PM
To: cayenne-user@incubator.apache.org
Subject: Re: non-SQL query to find distinct relationships in an entity's
table?


On 5/15/06, Michael Gentry <bl...@gmail.com> wrote:
> I wonder if you could do this by exposing the PK/FK attributes so that
> you could use them in an expression?

Well, I could use a db: prefix if we could come up with a valid
expression.

Re: non-SQL query to find distinct relationships in an entity's table?

Posted by Mike Kienenberger <mk...@gmail.com>.
On 5/15/06, Michael Gentry <bl...@gmail.com> wrote:
> I wonder if you could do this by exposing the PK/FK attributes so that
> you could use them in an expression?

Well, I could use a db: prefix if we could come up with a valid expression.

Re: non-SQL query to find distinct relationships in an entity's table?

Posted by Michael Gentry <bl...@gmail.com>.
I wonder if you could do this by exposing the PK/FK attributes so that
you could use them in an expression?

/dev/mrg


On 5/10/06, Mike Kienenberger <mk...@gmail.com> wrote:
> I'm building a search panel, and I want to populate one of the search
> criteria fields with the distinct list of values in the table being
> searched.
>
> Basically, the DataObject results returned from:
>
> select * from OTHER_TABLE
>     where OTHER_TABLE_PK in
>         (select distinct(OTHER_TABLE_FK) from SEARCHED_TABLE)
>
> Is there a way to do this other than using SQL Template?
>