You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jason Lane <ja...@root10.net> on 2004/06/01 15:51:51 UTC

dynamic query help

Hi list,

I have this ESQL query to my DB:

<esql:query>select id, area from ukareas order by area</esql:query>

This just returns the column rows "ID" and "AREA"

I also have this table which maps tables ukareas and county

create table navmap (
	aid integer,
	cid integer,
	primary key (aid,cid),
	foreign key (id) references ukareas(id),
	foreign key (id) references county(id)
);

I then have this query:

<esql:query>select county from county, navmap where navmap.cid = 
county.id and aid= 'X ' order by county</esql:query>

Where 'X' is the result of ukareas.id column, so essentially I'd like 
to do something like

for (int i = 0; i &lt; id.length; i++) {
//where id = ukareas.id
	<esql:query>select county from county, navmap where navmap.cid = 
county.id and aid= '<xsp:expr>id[i]</xsp:expr>' order by 
county</esql:query>
}
  essentially I'd be outputing something like:

South - East
	Surrey, Kent, etc...
Anglia
	Norfolk, Suffolk, etc...

I have a very, very rough idea of how I could do this but need some 
pointers.

Many thanks all.

Jason


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org