Solved

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

Posted on 2004-08-10
2
341 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
firstswap challenge 20 77
Base1 Encode/Decode 3 77
simplest php form 3 79
How to get time difference in minutes and seconds only between 2 dates 2 41
Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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…

810 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