-
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 )
-
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Click Here to Expand Forum to Full Width
|
Bookmarks