Solved

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

Posted on 2004-08-10
2
330 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
2 Comments
 
LVL 1

Accepted Solution

by:
jmeree earned 250 total points
Comment Utility
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
Comment Utility
thank you jmeree
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now