If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Outer Join and Sort.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-10-10, 22:22
DB2begin DB2begin is offline
Registered User
 
Join Date: Mar 2010
Posts: 4
Outer Join and Sort.

I have been learning a lot by posting and going through various posts. Thanks for all your help everyone.

Here is my question with sample data.


TableA

HTML Code:
CD    VALUE   CTGRY     ID       EFCTV-DT     START-DT       STop-dt

05     EE         H      3        03/15/2009   01/12/2009      NULL
11     AA         Z      1        07/15/2009   07/15/2009      null
15     JJ         Z      3        03/15/2009   01/12/2009       NULL
12     BB         Z      5        03/23/2006   03/16/2009      07/15/2009

CTGRY

Code:
CTG   DESCRIPTION
Z        I like letter Z
H        I like letter H
TABLEB

Code:
CD   CTG   ID   EFCTV_DT     sTART-DT    STOP-DT
12    Z       3   05/12/2009  05/12/2009   NULL.
Result Table should look like below.

Code:
cD   VALUE   CTG      ID   TABLE-A.EFCTV-DT    TABLE-B.EFCTV-DT

05     EE       Z         3      03/15/2009              05/12/2009
11     JJ       H          3      03/15/2009                -----
Search criteria

WHERE ID = 3
AND EFCTV_DT = 03/15/2009.

AND TABLE-A.CTG = CTGRY.CTG

ORDER BY CTGRY.DESCRIPTION descending.
Reply With Quote
  #2 (permalink)  
Old 05-11-10, 08:34
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
so what is your question? To maybe head off your actual question with an answer you could look at a 2 part article that Terry Purcell wrote years ago where you might find what you are looking for.
Meet the experts: Terry Purcell on coding predicates in outer joins: A comparison of simple outer join constructs
Meet the experts: Terry Purcell on coding predicates in outer joins: Advanced outer join constructs
Dave
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On