Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4031884
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:39:10+00:00 2026-05-20T11:39:10+00:00

I have to read a set of rows from a table(say A) containing a

  • 0

I have to read a set of rows from a table(say A) containing a unique id for each row (say id_value).

Now using this id_value i have to get rows from another table (say B).

i am using java so my code is:

ResultSet rs= [ Code to get rows from table A ] ;

while(rs.next())
{
ResultSet rs2= [Code to get rows from table B using the id_value from table A using rs.getString("id_value");]; 
}

The above query if ofcourse slow as the number of rows can be more than 500 at a time in table A.

Does anybody knows a better and fast solution to this problem or how to do this in a single query ??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:39:11+00:00Added an answer on May 20, 2026 at 11:39 am

    You should read up on joins in SQL: http://en.wikipedia.org/wiki/Join_(SQL)

    You want to do something along these lines:

    SELECT a.value_1, a.value_2, b.value_1, b.value_2
    FROM table_a AS a
    LEFT JOIN table_b AS b
    ON a.id_value = b.table_a_id
    WHERE a.value_1 = "something"
    

    It would be easier to help you if you had actual queries, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large table (2,000,000 rows) and I'd like to print each record
I have a composite UNIQUE set of columns in my table. Therefore if I
I have a table with say 1640 items. I set bindingSource.Filter = some filter
I have the following code: $SQL = UPDATE jobs SET read = '1' WHERE
On Ubuntu Linux, with Bash, I have /etc/profile set with read-only variables on login.
I have tried the obvious SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED, but my
I have read few articles about table partioning but still I am bit confused
I have identified a way to get fast paged results from the database using
I have a stored proc which inserts rows from a view with ranks into
Please read Update1 first! This is SSIS specific question. I have the following tasks:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.