I'm fetching records from db and by using JSTL sql query tag and then foreach tag results are showing BUT my issue is I want to use these results into other sql queries. how can i get these values and put into other sql queries tags?

SELECT * FROM report WHERE report.`id` = (SELECT MAX(id) FROM report );  
<sql:query dataSource="${db}" var="c">
  SELECT name from city where id = <!--2. WANT TO USE IT HERE?   -->
<table border="2" width="100%">  
<th>Report #</th> 
<th>City #</th>  
<th>Weather Condition #</th>  
<th>Weather Type #</th>  
<th>Date and Time</th>  
<c:forEach var="table" items="${rs.rows}">  
<td><c:out value="${table.id}"/></td>  
<td><c:out value="${table.city}"/></td>  <!--1. WANT TO GET THIS VALUE --->
<td><c:out value="${table.condtions}"/></td>  
<td><c:out value="${table.type}"/></td> 
<td><c:out value="${table.date}"/></td> 

0 Answers