+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2000
    Location
    Shanghai
    Posts
    433
    T1 : PK is A,B,C ;
    T2 : PK is A,B,D;

    Data is looks like this

    T1: A , B , C1 T2: A , B , D1
    A , B , C2 A , B , D2
    A , B , C3

    (For Same A , B combination , The records number in T1 is always large than in T2 )

    I want to write a sql to show such result:

    A , B , C1 , D1 ,
    A , B , C2 , D2 ,
    A , B , C3 , blank


    How do I do ? ( the question is urgent , Please help me )

  2. #2
    Join Date
    Nov 2000
    Location
    Israel
    Posts
    268
    Hi,
    Try this:

    select t1.a,t1.b,c,d
    from t1,t2
    union
    select t1.a,t1.b,c,d
    from t1,t2
    group by t1.a,t1.b,c,d
    order by a,b,c;

    good luck.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Click Here to Expand Forum to Full Width