Advertisement

06.03.2008 at 06:54AM PDT, ID: 23453119
[x]
Attachment Details

Multiple UNION with VERSION field...

Asked by bganoush in DB2 Database, Databases Miscellaneous, Data Mining

Tags: DB2

I need help.

I have three tables, CROSSREF, NAMEREF and EMPREF defined with these fields:

EMPREF contains EMPID, VERSION and MGRCODE
CROSSREF contains EMPID and NAMEID
NAMEREF contains NAMEID, FULLNAME

What I need to do is to pull out all the employees with MGRCODE = '1' and then pull out all the FULLNAME values from NAMEREF. The NAMEREF is taken from crossreferencing the CROSSREF table with the EMPID to get a NAMEID.  To make things worse, the VERSION field is a timestamp where there could be more than one VERSION of the same employee. I only need the latest one.

I'm not really sure how to do this... Is it a simple Union or a join?  And how do I deal with the VERSION, is there a way to get the most recent one?

Please help!

Start Free Trial
 
 
[+][-]06.03.2008 at 07:10AM PDT, ID: 21700591

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: DB2 Database, Databases Miscellaneous, Data Mining
Tags: DB2
Sign Up Now!
Solution Provided By: momi_sabag
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.03.2008 at 09:03AM PDT, ID: 21701772

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 09:09AM PDT, ID: 21701831

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 09:16AM PDT, ID: 21701922

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 09:52AM PDT, ID: 21702239

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 09:57AM PDT, ID: 21702276

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.03.2008 at 10:13AM PDT, ID: 21702437

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628