Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-08-10
2
Medium Priority
?
377 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 1000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

972 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