File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes join sql statements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "join sql statements" Watch "join sql statements" New topic

join sql statements

Jeff Sunder
Ranch Hand

Joined: Jun 26, 2001
Posts: 47
I am writing an application that connects to a database. I run a select sql statement that joins two tables and I am trying to put the sql results into variables. But I am unable to, the values of the variables is always null. But when I try a simple select statment without a join, it works fine. Is there something that I am missing ? Why does it not work when I join the two tables. In my code, I have ResultSet rs = stmt.executeQuesty(sql); Do I have to use a different method of the statement object ? Any help is appreciated.
Kareem Gad
Ranch Hand

Joined: Aug 06, 2001
Posts: 89
no man just make sure your sql statement actually gets results u want.. try running it directly on the database to see what you get.
If the sql statement is correct and all, then i suggest u try this. It is better practice not to select * from table, especially in joins because the issue of the column arrangement has a question mark. It is better to select only the column names that you specifically want and then that should make it really clear .
if the problem still persists tell me what u get exactly.


<b><i>KaReEm</i><br /><ul type="square"><li>SCJP-Free Range Web Developer <br /></ul></b>
I agree. Here's the link:
subject: join sql statements