Doubt on creating join between two tables
Hi friends,
I have two tables , ekes and eine
my requirement is if Ekes-ebtyp = 'X1'.
then Ekes-ebtyp = EKES-EINDT + Eine-j_3alitra.
the doubt is there is no primary key common between this table . actually in my whole program for purchase order i used EBELN for extracting details when two tables are involved . in this two tables no two primary keys are common to extract data ...is there any ways please suggest..
the code i wrote is
loop at li_ekes assigning <fl_ekes>.
read table li_eine assigning <fl_eine> with table key (here i need to give some unique fields to join these two fields please guide me which field i can use.).
<fl_ekes>-ebtyp = <fl_ekes>-EINDT + <fl_eine>-j_3alitra.
Hi,
Both tables have field EBELN in common.
You can use it to extract data from both.
Hope this helps.
reward if helpful.
Regards,
Sipra
Similar Messages
-
Subject: How to do join between two tables using something like SE16
SE16, SE11 provide form based interface query information from a single table. Is there a way to do join between two tables without creating an infoset erc? I am looking for something similar to sql join but in SAP BI 7.0
Thanks.Hi
Pls look into below links. Hope this helps you.
1. http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb45bf455611d189710000e8322d00/content.htm
2. http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb45a5455611d189710000e8322d00/content.htm
Regards
Sirigiri -
Multiple foreign key joins between two tables
Hi,
I have a question about building a repository.
I have a date dimension and one fact. The fact table has about 10 foreign key columns that link to the date Dimension.
In this case should I create 10 aliases to create joins in the Physical and BMM layer or is there any other way to handle this situation.
I am asking this question because 10 aliases can get very confusing for me at the later point of time while creating reports.
Using OBIEE 10.1.3Hi
I have a follow up question on this.
I am okay with not seeing the different date tables under the Subject area. Even if it just shows a it as a Simple DATE Dimension I am good with it.
In this case which is the efficient way, creating 10 aliases or creating 10 joins in the physical layer. I just figured out that we can create multiple joins between the same set of two tables but do not know how will that effect the way BI server works.
Please help me in understanding this concept.
thanks
This request id for OBIEE 10.1.3 -
Join between two tables in SAP ( actual sales vs budget sales)
I have one table with actual data sales in SAP .This table has a name CE11000
This table contain amounts about : customers ,Products, Quantity of Sales ,amount of sales ,month witch did the sales and the year.
The other table from SAP has the budget sales . This table is CE21000
This table contain the same fields : customers ,Products, Quantity of Sales ,amount of sales ,month witch did the sales and the year but all this for budget .
In the budget table ( CE21000)there are no records for a particular make if it was not budgeted to make a sale.
Sometimes i have the same problem with the actual data table (CE11000) ...I have not records witch can use to join the results for a report witch take the comparison between actual sales and budget sales.
I would like to remind you that the report should have four "dimensions"
a) year
b) month
c) customer
d) type of product
I try to use left outer join with a customer fields in two tables but i have simultaneously the field with type of product .
I want to see in one year (for example february of 2011) for one customer the type of products (quantity and anmounts) witch buy (ACTUAL) and that to compare with the corresponding data if available
Any help would appreciate
thanksHaggar
Your first query matches on two conditions BOTH being true. If there is a D and no matching E, you'll see the columns from D but none from E.
Your second query takes all Emplyees, and lines up 2 (possibly different) rows from D against each
E columns | D columns (match e.deptid=d.dept_id) | D columns (match ep_id=de_id)
So you may have any mix of:
E | D1 | D2
E | nothing | D2
nothing | D1 | D2
E | D1 | nothing
E | nothing | nothing
nothing | D1 | nothing
nothing | nothing | D2(NB I'm assuming FULL OUTER JOIN is commutative - ie the order is unimportant - but I may be wrong in which case the last row won't occur)
You will get a different number of rows (as well as different columns) in each case.
Try it!
Regards Nigel -
hello all,
can anyone help me write an outer join b/n the two tables below. The joining condition has if's and or's.
table 1 has 2 million rows, table 2 is very small
TABLE1
CUSTOMER_ID
CITY
STATE
1
SKOKIE
IL
2
CHICAGO
IL
3
CARY
NC
ERIE
PA
PHILLY
PA
CHARLOTE
NC
2 MILLION
CITYXY
STATEX
TABLE2
CITY
STATE
CONTACT
IL
OJO
ERIE
BRITT
PA
MIKE
PITTSBURG
PA
HILTON
N043
TAT
affi
B
affi
R
b0b
Q
b0b
CHARLOTE
NC
b0b
problem :: for all the data in table1, I need to find out the CONTACT from table 2 And the join condition would be as below
1. either both TABLE1.CITY=TABLE2.CITY AND TABLE1.STATE=TABLE2.STATE and get CONTACT
OR
2. TABLE1.CITY=TABLE2.CITY AND TABLE2.STATE IS NULL and get the value of CONTACT
OR
3. TABLE1.STATE=TABLE2.STATE AND TABLE2.CITY is null and get the value of CONTACT
I need a query like this
SELECT A.CUSTOMER_ID, A.CITY, A.STATE, B.CONTACT
FROM TABLE1 A, TABLE2 B
WHERE (join condition fitting in the 3 condition mentioned above)Dear OP,
Do you want something like this?
> with t1 as
-- Start of SAMPLE DATA
(select 1 CUSTOMER_ID, 'SKOKIE' CITY, 'IL' STATE from dual union
select 2, 'CHICAGO', 'IL' from dual union
select 3, 'CARY', 'NC' from dual union
select 4, 'ERIE', 'PA' from dual union
select 5, 'PHILLY', 'PA' from dual union
select 6, 'CHARLOTE', 'NC' from dual)
t2 as
(select null CITY, 'IL' STATE, 'OJO' CONTACT from dual union
select 'ERIE', null, 'BRITT' from dual union
select null, 'PA', 'MIKE' from dual union
select 'PITTSBURG', 'PA', 'HILTON' from dual union
select 'N043', 'TAT', 'affi' from dual union
select null,'B', 'affi' from dual union
select null,'R', 'b0b' from dual union
select null,'Q', 'b0b' from dual union
select 'CHARLOTE', 'NC', 'b0b' from dual
--- END IF SAMPLE Data
select * from t1 full outer join t2
on ( nvl(t1.city,t2.city) = nvl(t2.city,t1.city)
and nvl(t1.state,t2.state) = nvl(t2.state,t1.state) )
order by 1,2,3,4
CUSTOMER_ID CITY STATE CITY STATE CONTACT
1 SKOKIE IL IL OJO
2 CHICAGO IL IL OJO
3 CARY NC
4 ERIE PA ERIE BRITT
4 ERIE PA PA MIKE
5 PHILLY PA PA MIKE
6 CHARLOTE NC CHARLOTE NC b0b
N043 TAT affi
PITTSBURG PA HILTON
B affi
Q b0b
R b0b
12 rows selected
Elapsed: 00:00:00.112
Hope this is helpful. If not please let us know what is you desired result (sample) if your data was like above?
vr,
Sudhakar -
Joins between two tables generating Cartesian product
Hi All,
I am facing an issue in my report in which, I am getting mismatch as the two subsets which I'm joining is resulting in a cartesian product of individual subset's results. I am doing left join to join those two subsets. Please help in resolving
this issue.
Thank you,
Anu.Hi,
Can you please post your script to see what is causing the cartesian product?
This way it is difficult to help you.
Regards,
Reshma
Please Vote as Helpful if an answer is helpful and/or Please mark Proposed as Answer or Mark As Answer when question is answered -
Update Multiple Column with Single Command with Join between Two tables.
This is our command where we are trying to update a table's two columns by pulling values from another table after joining. This query takes too much time to execute. Any suggestions ?
UPDATE raw_alc_rmfscombinednew
SET (BSC, CELL_NAME) =
SELECT distinct raw_alc_R110combinednew.BSC, raw_alc_R110combinednew.CELL_NAME
FROM raw_alc_R110Combinednew
WHERE
raw_alc_R110Combinednew.OMC_ID = raw_alc_rmfscombinednew.OMC_ID
AND raw_alc_R110Combinednew.CELL_CI = raw_alc_rmfscombinednew.CI
AND RAW_ALC_R110COMBINEDNEW.START_TIME = RAW_ALC_RMFSCOMBINEDNEW.START_TIME
Results of Last execution:
Elapsed Time (sec) 4,476.56
CPU Time (sec) 4,471.88
Wait Time (sec) 4.68
Executions that Fetched all Rows (%) 100.00
Average Persistent Mem (KB) 32.43
Average Runtime Mem (KB) 31.59
--------------------------------------------------------------Your update requires a full execution of the subquery for each row in the destination table (raw_alc_rmfscombinednew). Try rewriting as a MERGE. Tons faster.
MERGE INTO raw_alc_rmfscombinednew D
USING ( SELECT distinct
BSC,
CELL_NAME
START_TIME
FROM raw_alc_R110Combinednew ) S
ON ( S.OMC_ID = D.OMC_ID
AND S.CELL_CI = D.CI
AND S.START_TIME = D.START_TIME )
WHEN MATCHED THEN
UPDATE
SET D.BSC = S.BSC,
D.CELL_NAME = S.CELL_NAME -
Hi
I need data from two different schemas. Can develop one subject area taking 2 tables from 2 different schemas or we need to have these two tables from one schema only ?
Can any one help on this.
Thanks
ManuHi,
When you try to create physical join between these two tables of different schemas.
The join condition is REGION.REGION_CODE = REGION.REGION_ID
Note: The table name is same in both the schema.
Now as soon as I click on Ok, it gives an error.Because You can not create join between two tables with the same name.
So, create alias for these two tables and try to create the join with the same join condition.
It allowed me to create join perfectly. I moved ahead with the creation of Subject Area based out of these two tables.
Opened Presentation Services, selected few attributes from both the Presentation folders.But it gave ODBC error as :
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 46036] Internal Assertion: Condition m_CountFields == static_cast<int32>(m_ColumnNameVector.size()), file .\Src\SQCSCacheStorageListStream.cpp, line 221. (HY000)
Now in order to fix that issue, rename the base tables as Schema1_name.REGION and Schema2_name.REGION in the repository.
Reload the rpd and run the same report, it would give correct result.
But instead you can have the tables in the same schema for better maintenance activities.
Hope this solved your question.
Regards
MuRam -
Inner Join between two big tables
Hi There,
I have a situation where in which I have to write an inner join between two table of the order of (30k to 60 rows).
My query is as simple as,
select A.a,B.b from A ,B where A.a = B.b;
N.B: a and b are of type varchar
But the problem is it takes nearly 15 mins to run. Is there any better way of doing an inner join between such bigger tables?
Thanks,
Jose John.Thank you all for your help.....Indexing works....:)
--JJ -
Sql join on two tables where column like another column
hi all,
been trying to get the results from a join between two tables where one column is like another one.
table1 (nameA) examples: black2, green1
table2 (nameB) example: black2.location.uk.com, green1.location.uk.com
so for example I want to match all those in table1 with black2 to the column in table2 that begins with black2 and so on if you see what im trying to get at!
my sql so far:
select * from schema.table1 a
join schema.table2 b
on a.nameA like concat('%', b.nameB, '%'); but it errors:
ORA-00909: invalid number of arguments
00909. 00000 - "invalid number of arguments"
Any help or advice would be greatly appreciated, thankyou!Either of these should do it...
select * from schema.table1 a
join schema.table2 b on a.nameA like '%'||b.nameB||'%';or
select * from schema.table1 a
join schema.table2 b on instr(b.nameB,a.nameA) > 0 -
Can we implement the custom sql query in CR for joining the two tables
Hi All,
Is there anyway to implement the custom sql query in CR for joining the two tables?
My requirement here is I need to write sql logics for joining the two tables...
Thanks,
GanaIn the Database Expert, expand the Create New Connection folder and browse the subfolders to locate your data source.
Log on to your data source if necessary.
Under your data source, double-click the Add Command node.
In the Add Command to Report dialog box, enter an appropriate query/command for the data source you have opened.
For example:
SELECT
Customer.`Customer ID`,
Customer.`Customer Name`,
Customer.`Last Year's Sales`,
Customer.`Region`,
Customer.`Country`,
Orders.`Order Amount`,
Orders.`Customer ID`,
Orders.`Order Date`
FROM
Customer Customer INNER JOIN Orders Orders ON
Customer.`Customer ID` = Orders.`Customer ID`
WHERE
(Customer.`Country` = 'USA' OR
Customer.`Country` = 'Canada') AND
Customer.`Last Year's Sales` < 10000.
ORDER BY
Customer.`Country` ASC,
Customer.`Region` ASC
Note: The use of double or single quotes (and other SQL syntax) is determined by the database driver used by your report. You must, however, manually add the quotes and other elements of the syntax as you create the command.
Optionally, you can create a parameter for your command by clicking Create and entering information in the Command Parameter dialog box.
For more information about creating parameters, see To create a parameter for a command object.
Click OK.
You are returned to the Report Designer. In the Field Explorer, under Database Fields, a Command table appears listing the database fields you specified.
Note:
To construct the virtual table from your Command, the command must be executed once. If the command has parameters, you will be prompted to enter values for each one.
By default, your command is called Command. You can change its alias by selecting it and pressing F2. -
Need to find the Difference between two table
Hello ,
I have stucked in program as below scenario:-
I have two tables of huge data of same structure in a same schema.I need to find the difference exact values in tables.
By using MINUS we can find the difference between two table ,i need to find the what exact difference in the there values with colunm and value at that column.
Example TableA
Col1 col2 col3 col4 col5.... col50
10 ABC 2001 EE 444 TT
40 XYZ 3002 RR 445 TT3
80 DEF 6005 YY 446 YY8
TableB
Col1 col2 col3 col4 col5.... col50
10 ABC 2001 EE 444 TT
40 XYZ 3002 RR 445 TT3
81 DEF 6005 Yu 447 YY8
I need to the out put like this :-
The Diffence between two table is
TableA.COL1=80 TableB.Col1=81, Different
TableA.Col4=YY TableB.col4=Yu,Different
TableA.Col5=446TableB.col5=447,Different
Please suggest me to write the pl/sql program for the same
thanx in advance
KKThanx friends for all your efforts
I have a sample code for the same,this will compare the two tables for single row in each table .
what r the modification needed for the multiple rows of values in the two tables??
Please suggest!!
CREATE OR REPLACE PROCEDURE test_compare
IS
TYPE t_col
IS
TABLE OF VARCHAR2 (30)
INDEX BY PLS_INTEGER;
l_col t_col;
j NUMBER := 0;
l_sql VARCHAR2 (2000);
col1 VARCHAR2 (30);
col2 VARCHAR2 (30);
val1 NUMBER;
val2 NUMBER;
status VARCHAR2 (30);
CURSOR c1
IS
SELECT column_id, column_name
FROM all_tab_columns
WHERE table_name = 'TEST1';
BEGIN
FOR i IN c1
LOOP
j := j + 1;
l_col (j) := i.column_name;
END LOOP;
FOR k IN 1 .. j
LOOP
l_sql :=
'SELECT '
|| ''''
|| l_col (k)
|| ''''
|| ', '
|| 'TEST2.'
|| l_col (k)
|| ', '
|| ''''
|| l_col (k)
|| ''''
|| ', '
|| 'TEST1.'
|| l_col (k )
|| ', '
|| 'DECODE(TEST2.'
|| l_col (k)
|| ' -TEST1.'
|| l_col (k)
|| ', 0, ''NO CHANGE'', ''CHANGED'') FROM TEST2, TEST1';
EXECUTE IMMEDIATE l_sql INTO col1, val1,col2, val2, status;
IF status = 'CHANGED'
THEN
DBMS_OUTPUT.put_line( 'TEST2.'
|| col1
|| '='
|| val1
|| ', TEST1.'
|| col2
|| '='
|| val2
|| ', '
|| status);
END IF;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Error:- ' || SQLERRM);
END;
/ -
How to provide joins between oracle tables and sql server tables
Hi,
I have a requirement that i need to generate a report form two different data base. i.e Oracle and Sql Server.
how to provide joins between oracle tables and sql server tables ? Any help on this
Regards,
Malliuser10675696 wrote:
I have a requirement that i need to generate a report form two different data base. i.e Oracle and Sql Server. Bad idea most times. Heterogeneous joins do not exactly scale and performance can be severely degraded by network speed and b/w availability. And there is nothing you can do in the application and database layers to address performance issue at the network level in this case - your code's performance is simply at the mercy of network performance. With a single glaring fact - network performance is continually degrading. All the time. Always. Until it is upgraded. When the performance degradation starts all over again.
If the tables are not small (few 1000 rows each) and row volumes static, I would not consider doing a heterogeneous join. Instead I would rather go for a materialised view on the Oracle side, use a proper table and index structure, and do a local database join. -
How to write select statement between two tables
hi,
i need to do comparision between two table for each records.ex:
table1:
regid regno ind
1 1001
1 1002
1 1003
1 1004
and table2:
regid regno
1 1002
1 1005
i need to select first row from table and loop for values in second table, if the values found first record , the record must update 'yes' to ind, if not 'No'.
please help with this.
thanks in advance
rajaHi Raja,
Do it like this. loop the first table and read the second table.
Use where condition to satisfy the conditions.
Or
In your select query use joins. Like this.
SELECT mara~matnr
marc~werks
INTO TABLE t_material
FROM mara AS mara INNER JOIN marc AS marc
ON maramatnr = marcmatnr
WHERE mara~mtart = p_mtart.
Instead of MARA and MARC here use your tables.
Much Regards,
Amuktha. -
Create relation between two blocks which are based on different procedure
Hiii
How to create relation between two blocks which are based on different stored procedures in Oracle form??
Pradhyumn Sharmahiii,
I selected the common key deptno in both procedure.
I created a relation between both procedure. but when i compile the form it give an error in ON-CHECK-DELETE-MASTER. My procedure are
==================================
PACKAGE emp_pkg AS
TYPE emprec IS RECORD(
empno asg_emp.empno%type,
ename asg_emp.ename%type,
job asg_emp.job%type,
sal asg_emp.sal%type,
deptno asg_emp.deptno%type);
TYPE emptab IS TABLE OF emprec INDEX BY BINARY_INTEGER;
PROCEDURE empquery(block_data IN OUT emptab, p_deptno IN NUMBER);
end;
====================================
PACKAGE dept_rec IS
type rec is record(dname asg_dept.dname%type,
loc asg_dept.loc%type,
deptno asg_dept.deptno%type);
type deptrec is table of rec index by binary_integer;
PROCEDURE dept_rec1(block1 in out deptrec);
END;
===================================
In ON-CHECK-DELETE-MASTER
CURSOR BLOCK9_cur IS
SELECT 1 FROM dept_rec.dept_rec1 d
WHERE d.DEPTNO = :BLOCK6.DEPTNO;
identifier dept_rec.dept_rec1 must be declared.
Regards
Pradhyumn
Maybe you are looking for
-
How to see multiple levels of photo folders?
Using my Apple TV2 and home sharing with iTunes on a Windows xp pro pc, my folder tree for ohotos has 4 levels - my pictures, year, events, sub events; apple tv shows only the year level and groups together alll the photos in the sub folders. Is the
-
IPad mini w/Retina, which power adaptor?
I purchased an iPad Mini w/retina about 4 days ago. It came with a 10W power adaptor. The adaptor looks the same as the 12W power adaptor that Apple sells as an accessory, I bought one some months ago at an Apple store to use with my iPhone 5C and w
-
How to resize photos for retina display to avoid pixelation?
My original image file looks fine but after scaling down, it looks pixelated. However, it looks fine on non-retina display. Why is this so and how do I solve it? Would appreciate your help!
-
No file association in konqueror on fluxbox
hi. on kde konqueror works fine but on fluxbox when i want to open some file I always heve to "Open With..." and write the app i want to use;/ also when i check "remember application association for this type of file" i doesnt' seve it ;/ any ideas??
-
Tolerance Limit at PO document level
Is there a way I can do the tolerance limit at PO document level ? I can't do at company code level as we buy materials overseas too and we don't want to have any restriction on those . Thanks