• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

join sql statements

 
Jeff Sunder
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

------------------
KaReEm
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic