I am trying to join two master files created from SQL server tables.
Table A contains one primary key Key1.
Table B contains composite primary keys.Key1+Key2
I am writing a join condition as follows
Key 1 in Table A to
Key 1 in table B as J0
Table file TableA
Which retrieves records.But,swiching on the SQLTrace SET paramter(SET TRACEON=SQLAGGR//CLIENT) shows error 25901 and 25904 in the view source text file.
Can any one help me or explain me how exactly the joins are working and how to overcome this error.
Because Table B has a composite key, then Key1 may occur multiple times, so you would have to either do
Join Key1 in TableA to ALL Key1 in TableB
or Use TableB instead of TableA and then ...
Join Key1 in TableB to Key1 in TableA
Your current situation may be retrieving some records, but it's only getting the first joined record and not all of them. Thus the keyword 'ALL'.
Good luck, TerryW
thank you so much.But I used ALL before looking into the reply.My need has become different-I need MATRIX.
I have 2 rows in table TABLE1 for the key KEYA and TABLEB contains the 3 rows for the same key KEYA.
Following is an Example:
Now I want to join Table A and Table B in such a way that i can get 2x3 matrix.
I tried as follows
col1 in TableA to
col1 in tableB as j0
As well as
col1 in TableA to
All col1 in tableB as j0
I am getting FOC1070 or FOC1071 error.FROM or TO value in Join is out of range.
Even after interchanging the position of the TableA and TableB, i am getting the same error.
Any idea to form the MATRIX is really helpful.
Both files need to be sorted (if they are flat files).
No they are not flat files...
My data is available in an RDBMS..
I am having a common problem with the datawarehouse is the data are populated with Many to Many relationship in all the tables.
Consider an Employee attended various training programs.(Training table)consider it contains 4 records.EmpId & Course code are serogate keys.
The dates attended is in another table. Consider for the same course it contains multiple rows.(Timetable)-Consider it contains 9 rows.EmpId & Dt_course_attended & courseid are serogate keys.
How to join these?
|Powered by Social Strata|