Prcedure to joining of two tables and pls explore the primary & foriegn key
Dear All,
Am new to this forum looking forward to have some discussions and guidance reg ABAP.
<b>My query is</b>
what is the prcedure to joining of two tables and pls explore the primary & foriegn key relationships.
Your kind help is required in this query .
Thanks n regards
Carol P
Hi Carol,
Joining two tables fetch data from tables that has relevent entry based on the keys. like LIKP and LIPS these are delivery tables. if the business requirement is fetching delivery data that are exists in both two tables. here LIKP will conatins a single entry against a condition and LIPS may contains several entry because one delivery may has multiple line items. so, fetch the data joining the two tables on vbeln that is delivrey number. this is used to increase the performance of the program except for all entries.
Foreign key is poiting twowards primary key; it may be 1:1 , 1:many and many:many. if field1 of table a is pointing towards field1 of table b. then based on these condition at the time of entry SAP will check how many entry can be entred in field1 of table a.
regards
Krishnendu
Similar Messages
-
Compare two tables and log the difference
Hi,
I want to compare two tables and log the difference in new table with the fields as (old value,new value, column name). The column name should be the changes value columnCan you show an example?
SELECT Foo.*, Bar.*
FROM Foo
FULL OUTER JOIN
Bar
ON Foo.c1 = Bar.c1
AND Foo.c2 = Bar.c2
AND Foo.cn = Bar.cn
WHERE Foo.key IS NULL
OR Bar.key IS NULL;
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
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. -
Join on two tables using "LIKE"
Hi all,
I need make join on two tables (QMEL and STXL) using keys for connection:
- field for join of first table is (QMEL-QMNUM - Notif. number - Char 12)
- field for join of second table is (STXL-TDNAME - Char 70)
If it is connection based on EQ, I think, it's no problem but I need to connect it on base of 'LIKE'.
Example:
QMEL-QMNUM = '100100698075'
I would like get all rows from STXL which contain or even better start with notif. number.
Examples I would like connect with QMEL-QMNUM:
STXL-TDNAME = '100100698075'
STXL-TDNAME = '1001006980750001'
STXL-TDNAME = '10010069807500010001'
STXL-TDNAME = '10010069807500010002'
etc..
Am I able to manage that with select which join these two tables this way?
Thanks for any solution
Vaclav Hosek.Hi,
Write 2 separate selects for this.
select * from QMEL
where......
if sy-subrc = 0.
loop at i_qmel into wa.
r_tdname-option = 'CP'.
r_tdname-sign = 'I'
concatenate wa-qnum '*' into r_tdname-low.
append r_tdname.
endloop.
select *
from STL
where tdname in r_tdname.
endif. -
Hi to all.. i have this two table , the problem is i dunno how to join this two table into one, becoz in the forms i have two button "BUTTON A IS FOR TABLE A WHICH IS THE EMPLOYEE.. AND BUTTON B IS FOR ADMIN... WHAT I WANT IS TO MAKE THIS TWO BUTTON INTO ONE BUTTON.. i;m using form6i and run in client server..
Guys any one here know plz help how to do this..
TABLE 1
BEGIN
iF :username IS NULL THEN
MESSAGE ('Please enter Username ');
MESSAGE ('Please enter Username ');
GO_ITEM('username');
RAISE FORM_TRIGGER_FAILURE;
end if;
IF :PASSNAME1 IS NULL THEN
MESSAGE('Please enter password.');
MESSAGE('Please enter password.');
GO_ITEM('PASSNAME1');
RAISE FORM_TRIGGER_FAILURE;
end if;
select username,passname
into :pass.username,:pass.passname1
from Employees
where :pass.username=username
and :pass.passname1=passname;
Message('Access Granted');
Message('Access Granted');
go_block('maina');
hide_view('pass1');
exception
when no_Data_found then
set_alert_Property('wrong',Alert_Message_text,'Invalid Password');
if show_alert('wrong')=alert_button1 then
go_item('PASSNAME1');
:passname1:=null;
end if;
end;
TABLE 2
BEGIN
iF :username IS NULL THEN
MESSAGE ('Please enter Username ');
MESSAGE ('Please enter Username ');
GO_ITEM('username');
RAISE FORM_TRIGGER_FAILURE;
end if;
IF :PASSNAME1 IS NULL THEN
MESSAGE('Please enter password.');
MESSAGE('Please enter password.');
GO_ITEM('PASSNAME1');
RAISE FORM_TRIGGER_FAILURE;
end if;
select username,passname
into :pass.username,:pass.passname1
from Admin1
where :pass.username=username
and :pass.passname1=passname;
Message('Access Granted');
Message('Access Granted');
go_block('maina');
hide_view('pass1');
exception
when no_Data_found then
set_alert_Property('wrong',Alert_Message_text,'Invalid Password');
if show_alert('wrong')=alert_button1 then
go_item('PASSNAME1');
:passname1:=null;
end if;
end;like i told you before in this posting How to join this two tables
use a union
select username,passname
into :pass.username,:pass.passname1
from Employees
where :pass.username=username
and :pass.passname1=passname
union
select username,passname
into :pass.username,:pass.passname1
from Admin1
where :pass.username=username
and :pass.passname1=passname; -
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 -
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 -
Select from two tables and insert into a third
I'm trying to do a select from two tables and do an insert into a third table from the two resulting columns.
I have the following....
DECLARE
tempsid number;
temphostid number;
BEGIN
select "DBSID_ID","ID" into tempsid,temphostid from "DBSIDS","SERVERS"
where "HOST_SID" like '%'||"DBSID_NAME"||'%'
and "HOST_NAME" not like 'vio%'
and exists (select "DBSID_NAME" from DBSIDS)
order by "DBSID_NAME";
insert into "DBSID_LOOKUP" ("SIDLOOKUP_ID", "SERVERLOOKUP_ID")
values(tempsid, temphostsid);
END;
run;
I get the error ....
ORA-06550: line 11, column 18:
PL/SQL: ORA-00984: column not allowed here
ORA-06550: line 10, column 1:
PL/SQL: SQL Statement ignored
1. DECLARE
2. tempsid number;
3. temphostid number;okay ... I tried a different way ...
DECLARE
a number;
b number;
BEGIN
select "DBSID_ID","ID" into a,b from "DBSIDS","SERVERS"
where "HOST_SID" like '%'||"DBSID_NAME"||'%'
and "HOST_NAME" not like 'vio%'
and exists (select "DBSID_NAME" from DBSIDS)
order by "DBSID_NAME";
insert into "DBSID_LOOKUP" (SIDLOOKUP_ID, SERVERLOOKUP_ID) values (a, b);
END;
and now it whines about ...
ORA-01422: exact fetch returns more than requested number of rows -
Inner join on Buffred table and not buffered table.
Hi guys,
Can you suggest me how can i write select query using inner join on buffered table and not buffered table. i written like this. is it right?
SELECT a~vbeln
a~vkorg
a~kunnr
a~kunag
a~wadat_ist
a~xblnr
b~bukrs
FROM likp AS a INNER JOIN tvko AS b
ON avkorg = bvkorg BYPASSING BUFFER
INTO TABLE itab_likp
WHERE vbeln = s_vbeln.
Thanks.
RAJHi Raj ,
Please find below my Commentes :
1. When you use "Bypassing buffer" clause in Select statement , the data what is there in the buffer of application sever is always ignored and Read is performed from the Physical database always. This Clause is advisable where you require realtime data (Not recommended generally in reporting)
2. It is advisable that you should not use small table in the innerjoin with big table. In the query you have written there are 2 tables:- LIKP and TVKO outof which TVKO is a master table containing very few records than LIKP (Contains huge data for Delivery header).
So my recommendation will be : -
1. Eliminate the "Bypassing Buffer" clause from your Query
2. Break the select query into 2 select queries breaking the join and with some ABAP logic populate the Internal table "itab_likp".
This will be optimum way inwhich you can write the select query for your senarion. Also Ensure that indexes are being used for better selectivity.
Hope this will help to you.
Regards,
Nikhil -
What are dyanmic internal tables and what s the exact use of forall entries
what are dyanmic internal tables and what s the exact use of forall entries?
hi,
<u><b>dynamic internal table.</b></u>
http://searchsap.techtarget.com/tip/1,289483,sid21_gci912390,00.html
http://www.sap-img.com/ab030.htm
<u><b>
FOR ALL ENTRIES</b></u> is an effective way of doing away with using JOIN on two tables.
You can check the below code -
SELECT BUKRS BELNR GJAHR AUGDT
FROM BSEG
INTO TABLE I_BSEG
WHERE BUKRS = ....
SELECT BUKRS BELNR BLART BLDAT
FROM BKPF
INTO TABLE I_BKPF
FOR ALL ENTRIES IN I_BSEG
WHERE BUKRS = I_BSEG-BUKRS
AND BELNR = I_BSEG-BELNR
AND BLDAT IN SO_BLDAT.
*******************************8
look another example
what is the use of FOR ALL ENTRIES
1. INNER JOIN
DBTAB1 <----
> DBTAB2
It is used to JOIN two DATABASE tables
having some COMMON fields.
2. Whereas
For All Entries,
DBTAB1 <----
> ITAB1
is not at all related to two DATABASE tables.
It is related to INTERNAL table.
3. If we want to fetch data
from some DBTABLE1
but we want to fetch
for only some records
which are contained in some internal table,
then we use for alll entries.
1. simple example of for all entries.
2. NOTE THAT
In for all entries,
it is NOT necessary to use TWO DBTABLES.
(as against JOIN)
3. use this program (just copy paste)
it will fetch data
from T001
FOR ONLY TWO COMPANIES (as mentioned in itab)
4
REPORT abc.
DATA : BEGIN OF itab OCCURS 0,
bukrs LIKE t001-bukrs,
END OF itab.
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
itab-bukrs = '1000'.
APPEND itab.
itab-bukrs = '1100'.
APPEND itab.
SELECT * FROM t001
INTO TABLE t001
FOR ALL ENTRIES IN itab
WHERE bukrs = itab-bukrs.
LOOP AT t001.
WRITE :/ t001-bukrs.
ENDLOOP.
Hope this helps!
Regards,
Anver -
Import data from few tables and export into the same tables on different db
I want to import data from few tables and export into the same tables on different database. But on the target database, additional columns have been added
to the same tables. how can i do the import?
Its urgent can anyone please help me do this?
Thanks.Hello Junior DBA,
maybe try it with the "copy command".
http://download.oracle.com/docs/cd/B14117_01/server.101/b12170/apb.htm
Have a look at the section "Understanding COPY Command Syntax".
Here is an example of a COPY command that copies only two columns from the source table, and copies only those rows in which the value of DEPARTMENT_ID is 30:Regards
Stefan -
11GR2
=-----------------------------------
I am using below querry to compare two table that has same name, under two different users... But after making storage information false like below and if the storage information is different on column level than it create "Alter modify " statements for the column ... How can I make my query to compare only columns of two tables... not the storage information?
begin
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PRETTY', TRUE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',TRUE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SEGMENT_ATTRIBUTES', FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE', FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'TABLESPACE',FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'CONSTRAINTS',FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'REF_CONSTRAINTS',FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'CONSTRAINTS_AS_ALTER',FALSE);
End;
select REGEXP_REPLACE(dbms_metadata_diff.compare_alter('TABLE','TABLE_NAME_A','TABLE_NAME_A','USER1','USER2'),('USER1...'),'', 1, 0, 'i') from dualI am using below querry to compare two table that has same name, under two different users... But after making storage information false like below and if the storage information is different on column level than it create "Alter modify " statements for the column ... How can I make my query to compare only columns of two tables... not the storage information?
If you want help you have to SHOW us what you are doing and how you are doing it; you can't just try to tell us in your own words.
We can't see your computer screen. -
Hi All,How2 delete a pkey for std table and add 2 new primary keys
Hi All,
How2 delete a pkey for std table and add 2 new primary key fields .Please provide me the required procedure .
Thanks&Regards.
Bharat.Hi Bharat,
First thing is you need to have the access key to change any standard dictionary object/standard programs/ standard transactions.You may get this from your basis person after getting approval from your respective manager.But changing or modifying the standard object is not recommended, but if there is no alternate to meet the business requirement then we have to follow this way only.
Next, you need to check whether this table's primary key is being used in any other table as foreing key or not. If there is, then you must remove this relation and then you can delete the unncessary primary key field from that table.Finally you can add the two new fields and set them as primary key, save, check for any errors and activate.
Hope this helps.
Please reward if useful.
Thanks,
Srinivasa -
I keep getting this message: AN ERROR OCURRED WHILE LOADING THIS CONTENT
ATV was working fine until i did a version update last week. Since then i have rented two movies and keep getting the same message
I restarted the ATV - no success
I reset my wireless - no success
I reset my ATV - no success
netflix is working fine since i was able to see a movie there. Youtube was also working fine. I think there should be something wrong with iTunes
Any ideas?I keep getting this message: AN ERROR OCURRED WHILE LOADING THIS CONTENT
ATV was working fine until i did a version update last week. Since then i have rented two movies and keep getting the same message
I restarted the ATV - no success
I reset my wireless - no success
I reset my ATV - no success
netflix is working fine since i was able to see a movie there. Youtube was also working fine. I think there should be something wrong with iTunes
Any ideas? -
I have two iPhones and synchronize with the same macbook. How do I segregate both applications and all the data?
Hi Jamesdwills,
Welcome to the Support Communities!
If you are using the same Apple ID on both devices, the Game Center profile should be the same.
Check out this information from the iPad User Guide. Try signing out of the Game Center on both devices and then sign back in with the correct Apple ID:
Using Game Center
http://support.apple.com/kb/ht4314
Game Center settings - iPad User Guide
http://help.apple.com/ipad/7/#/iPad9a13d039
Game Center settings
Go to Settings > Game Center, where you can:
Sign out (tap your Apple ID)
Allow invites
Let nearby players find you
Edit your Game Center profile (tap your nickname)
Get friend recommendations from Contacts or Facebook
Specify which notifications you want for Game Center. Go to Settings > Notifications > Game Center. If Game Center doesn’t appear, turn on Notifications.
Change restrictions for Game Center. Go to Settings > General > Restrictions.
Cheers,
- Judy
Maybe you are looking for
-
Does anyone know if there's an easy way to input accented characters (like é en ä) on the E70 with the phone folded open? I would have expected that switching to Dutch would change the input mode such that pressing for instance e and ' consecutively
-
Wireless nearly working, but can't ping
I've been trying to get wireless to work on my laptop using wpa_supplicant. I seem I be connected to the network, but I'm unable to ping google. Here's some info: bash-3.2# wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf Trying to associate
-
Damaged file notification - what does it mean and can it be fixed?
If InDesign CS3 crashes, and when re-opening the file, says it may be damaged, what might that mean? I can still open the file, work with it, save it, as if everything is OK. Might this be something I can find and fix? Thanks, Marcy
-
How can i download a powerpoint presentation onto my mac and then work on it to make it into a video
I have an older powerpoint presentation which I now want to download to my Mac and be able to change it and make it into a video with sound and music. Can I?
-
i forgot my nokia 6300 lock code. I even dont know how to get my phone IMEI Code pls help me to break the code