You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Manukyan, Sergey" <SM...@lear.com> on 2005/10/04 18:24:11 UTC

RE: subQueries in SELECT

Hi Jacob,

I had a look, all test cases describe cases when subquery is used to
check against condition in the where clause. There was no example how to
use data from subquery in the main query result set...

So I found examples that retrieve F1 from this query:

select F1 from T1 where T1.F1 in (select F1 from T2)

But I need something that retrieves F2:

select F1 , (select F2 from T2 where T1.F1 = T2.F1) from T1

.. any ideas?

Sergey




-----Original Message-----
From: Jakob Braeuchi [mailto:jbraeuchi@gmx.ch] 
Sent: Tuesday, September 27, 2005 3:47 PM
To: OJB Users List
Subject: Re: subQueries in SELECT

hi sergey,

please have a look at the subquery-testcases in 
org.apache.ojb.broker.QueryTest.

jakob

Manukyan, Sergey schrieb:
> Folks,
> 
> Can I represent in OJB this SQL statement:
> 
> SELECT C.cust_id, (SELECT count(*) FROM purchases P WHERE P.cust_id =
> C.cust_id)
> 
> FROM customer C
> 
> ?
> 
> It looks like this kind of SQL is much faster then when using SELECTS
> with GROUP BY and I would like to express it in OJB but didn't find
how
> in documentation,
> 
> Thank you,
> 
> Sergey
> 
> 
> **********************
> ** LEGAL DISCLAIMER **
> **********************
> 
> This E-mail message and any attachments may contain
> 
> legally privileged, confidential or proprietary
> 
> information. If you are not the intended recipient(s),
> or the employee or agent responsible for delivery of
> 
> this message to the intended recipient(s), you are
> 
> hereby notified that any dissemination, distribution
> 
> or copying of this E-mail message is strictly
> 
> prohibited. If you have received this message in
> 
> error, please immediately notify the sender and
> 
> delete this E-mail message from your computer.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org