• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Looping through records while looping through record

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have 2 tables.
I look through the first table to find all the records that have the users email and display them, but part of the information is in the table 2. so I need to compare id (item) in table one with the one in table 2 so I can get the item�s description from table 2.

hope this makes sense




Thankyou
[ January 08, 2006: Message edited by: Leonardo Pjetri ]
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see why this is a JSP question. But anyway, why don't you just write one SQL statement that joins the two tables? And stick a where-clause in it while you're doing the change. It's much more effective (both in programming time and processing time) to have the database return only the data you need.

(Your current problem is that you are trying to use the "rs" ResultSet without setting it back to its start. But write the join-SQL instead of trying to do that.)
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Leonardo",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is not a JSP question but a JDBC one.

You should get this code working in non-JSP java first. The I strongly receommend you not put the code directly within a JSP, but rather, keep it factored out in a class or bean that collects the data you want into an appropriate collection for passing to the JSP.

Moved to the JDBC forum.
 
Leonardo Pjetri
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@ Paul i see what you mean thanks got it:



@ Bear done
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic