How can I retrive data from a ResultSet when I made an SELECT over 2 tables?

You must Login before you can answer or comment on any questions.

Hi,

I have a SELECT like "SELECT attr.*, details.* from form_attribute attr, form_details details".

The query is working and I can see that it return some results but I can't find a way to get the value for common columns: By exampe is the form_attribute have a column "content" and form_details have as well a column "content" how can I get the value for form_attribute.content and form_details.content?

I tried with 1. rs.fieldByName("details_content") and rs.fieldByName("attr_content") but it returns null all the time. 2. rs.fieldByName("details.content") and rs.fieldByName("attr.content") : got null as well.

Thank you.

— asked 10 months ago by Liviu Ungureanu
2 Comments
  • can you post the output of the select so we get a better ide of how it look like

    — commented 10 months ago by Arian Caraballo

  • Also, you should only select what you need. If it happens to be the same column from both tables, do something like "select attr.id AS variable_1 , details.id AS variable_2 from form_attribute attr, form_details details

    — commented 10 months ago by Josh Lewis

Your Answer

Think you can help? Login to answer this question!