You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gustavo Nalle Fernandes <gu...@eccentia.com> on 2001/11/07 06:15:41 UTC

ESQL Nested Queries

	What is the best way to do nested queries using ESQL ? For example I want
to obtain something like:
		<class>
		   <student>
			<name>...</name>
			...
		   </student>
		</class>
		<class>
		   <student>
			<name>...</name>
			...
		   </student>
		</class>

	In my database I have two tables,CLASS and STUDENT.The query is something
like:
		SELECT  CLASS.*,STUDENT.* LEFT OUTER JOIN STUDENT ON CLASS.IDClass =
STUDENT.IDClass WHERE CLASS.IDSchool = 4

	The whole point is that I want to generate a hierarquical tree of database
objects without having to do several queries (I want to do just one,as shown
above) i.e.,for each class having to make another query to retrieve its
students.

	Is it possible to do something like this using xsp ,after obtaining the
row-results ?

	  for each class
		<class>
		   for each student
			<student>
				<name>..</name>
			<student>
		  end
		</class>
	  end




---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: ESQL Nested Queries

Posted by Hubert NEOtyk Iwaniuk <hu...@office.ferienwelt.com.pl>.
On Wed, Nov 07, 2001 at 02:15:41AM -0300, Gustavo Nalle Fernandes wrote:

Hi
 
> 	What is the best way to do nested queries using ESQL ? For example I want
> to obtain something like:
> 		<class>
> 		   <student>
> 			<name>...</name>
> 			...
> 		   </student>
> 		</class>
> 		<class>
> 		   <student>
> 			<name>...</name>
> 			...
> 		   </student>
> 		</class>
> 
> 	In my database I have two tables,CLASS and STUDENT.The query is something
> like:
> 		SELECT  CLASS.*,STUDENT.* LEFT OUTER JOIN STUDENT ON CLASS.IDClass =
> STUDENT.IDClass WHERE CLASS.IDSchool = 4
> 
> 	The whole point is that I want to generate a hierarquical tree of database
> objects without having to do several queries (I want to do just one,as shown
> above) i.e.,for each class having to make another query to retrieve its
> students.
> 
> 	Is it possible to do something like this using xsp ,after obtaining the
> row-results ?
> 
> 	  for each class
> 		<class>
> 		   for each student
> 			<student>
> 				<name>..</name>
> 			<student>
> 		  end
> 		</class>
> 	  end
>

To achieve this i use xslt after generation and then serialize to xml.

good luck,
	hubert. 

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>