Solved

In Java AND SQL, Access a parent table and display the data

Posted on 2004-08-10
2
365 Views
Last Modified: 2008-01-09
How do access AAAA  database table "Board_Cntrl_T",( parent table).
The primary key is an Bd_Id.
The Board_Cntrl_T  table has a numer of fields( only need a few of them).
 A table is "selected" if  the current date time is no earlier than 10 days prior to the c-dt  nor later than 10 days prior to the group’s c-dt. The data I need to display is from three other fields: bd_name, sys_user_id,sys_access_dt.   I would like to display the fields for me to see. This will get me started. Thank you
0
Comment
Question by:coolgem
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
jmeree earned 250 total points
ID: 11768024
Create a connection to database AAAA and a statement using your jdbc driver (here is one sample: http://archive.midrange.com/java400-l/200312/msg00165.html).  Create a string with your sql statement in it:

select bd_name, sys_user_id, sys_access_dt
from Board_Cntrl_T X, other_table Y
where Y.Bd_Id = X.Bd_Id   -- joins the parent to the child table
and sys_access_dt > (sysdate-10)   -- sysdate syntax depends on your database
and sys_access_dt > (group_cre_date)

If you want to select tables dynamically, you'll have to do two sql statements.  The first will get the table name from the system catalog (user_tables for oracle) and then select the data from the table in the second select statement.

I hope this helps. You didn't say what database you were using and you didn't give any info on the child tables.
0
 

Author Comment

by:coolgem
ID: 11842847
thank you jmeree
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Simple Linear Regression

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question