How to find varience records in two tables
Hi,
i have two tables like emp1, emp2
data in emp1:
empname empid add
alasta 10 ca
mark 20 nw
chews 30 jp
data in emp2:
empname empid add
alasta 10 ca
mark 20 nw
chews 30 jp
burgess 45 ngm
if u observe the above two tables data you can easily identify there is repeated data/duplicated data in both tables.
as there any way find out using comparison same records in two tables..........
if i write a query then i can easily understand the same data is existed in two tables
Thanks in advance....
>
as there any way find out using comparison same records in two tables..........
>
>
if i write a query then i can easily understand the same data is existed in two tables
>
So, what is your problem now?
You can join both the tables using a simple query and get the records.
select e1.empname, e2. empname from emp1 e1, emp2 e2 where
e1.empname = e2.empname and e1.empid = e2.empid
Similar Messages
-
To find matching records across two tables
Hi folks,
I have a question regarding modifying the query. I am trying to compare the data between two tables, there are matching records in two tables, but are not in the same order. How to modify the query so that it finds the matching record between the two tables?
Here is my code
loop at itab_A.
read table itab_B with key
employeenumber = itab_zmgr_training-empid binary search.
if sy-subrc = 0.
Any thoughts?
Thanks,
Sk
Here I am getting the return value as '4'I have tried all that, but why is it that while reading a record from itab_B I see no record in the header line,
Let me paste the entire code of what I am trying to achieve.
data: itab_A like A occurs 0 with header line.
data: itab_B like B occurs 0 with header line.
some validation.....
loop at itab_A.
read table itab_B with key employee number = empid binary search.
if sy-subrc =0.
per form validation.
else.
perform validation.
endif.
endloop.
My observation: while reading recrod from itab_B the header line is clear, no record is read here hence sy-subrc = 0.
How can I correct this? Since it is not reading any record from itab_B no matching record is found.
Any thoughts would be really helpful.
Thanks,
Santhosh. -
How to find unmatched records in huge tables
Hi,
I want to find out the faster approach, to find records in two tables which do not match.
To make it clear, lets say we have two tables.
table_1(col1 number, col2 varchar2(20), ....other columns)
and
table_2(col3 number, col4 varchar2(20), ....other columns)
col1, col2 from table_1 corresponds to col3, col4 of table_2.
If a record in table_1 does not exists in table_2 or if one of the column has different value, I want to find all such records.
Being Oracle developer, I can easily find that using "outer join" or using "exists".
But want to find out the fastest way, as those table has millions of records.
Maybe using segment or something like that...
Any suggestions?If "the" fastes way would exist oracle would not implement the others.
You will have to test it. The easiest way is to use set autotrace on in sqlplus and compere the consistent gets of both statements (by the way: there is also the MINUS operator with also leads to an outer join but is easier to read).
Dim -
How to find different rows in two tables which have same schema.
There are two tables t1 and t2, they have same schema. Table t1 includes the informtion of students last month,table t2 incude the information of the students this month. I want to find the difference of the same student between two months. What should I do and How to do?
Look a the following example:
Table TEST_1 TEST_2
ID ID_TX ID ID_TX
1 a 1 a
2 b 2 b
4 d 4 d
6 f 6 f
7 g 7 g
10 j 10 j
10 Z 10 x --- DIFFERENT
12 x --- DIFFERENT
20 x ---- DIFFERENT
Query:
Select * FROM
( (SELECT '1', ID, ID_TXT FROM TEST_1 MINUS SELECT '1', ID, ID_TXT FROM TEST_2)
UNION
(SELECT '2', ID, ID_TXT FROM TEST_2 MINUS SELECT '2', ID, ID_TXT FROM TEST_1) )
Order By ID
RESULTS:
' ID ID_TXT
1 10 Z
2 10 x
1 12 x
2 20 x -
Finding unmatched records between two tables
Hi,
Suppose there are two tables - A and B and they have a couple of common key fields. I want to select those records from A which do not have a matching record in B. What will be most efficient way to do that?
Thank you.Hey,
Look at this link .......... i think this may help you a bit to achieve ur requirement
http://help.sap.com/saphelp_470/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm
Comparing Internal Tables: -
Internal tables can be compared with the operands that are used to compare other data objects. The most important criteria for comparing the internal table are the number of lines they contain. The larger the number of lines, the larger it is for comparisons. If the both the internal tables have same number of lines, then they are compared line by line. The operands used for comparisons are LE, LT, GE, GT, EQ, NE.
Except for EQ, the comparison stops at the first pair of components that identifies the condition false. -
How to find common fields between two tables
Hi friends,
Is there any way to find out common fields between tables and linking the tables based on common fields.
Thanks and Regards,
Chitty.Hi Chitty,
Try using joins it will give the fields which are only common to both the fields.
Here s an example,
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.
Much Regards,
Amuktha. -
I have two tables - table1 and table2 - that have the exact same schema. There are three fields that can be used to compare the data of the two tables, field1, field2, and field3. When there are matching rows in the two tables (table1.field1/2/3 = table2.field1/2/3)
I want to replace table1.field4 with table2.field4 and replace table1.field5 with table2.field5.
I have worked with the query but have come up with goobly goop. I would appreciate any help. Thanks.If your field1, field2, and field3 combinations in these tables are unique, you
can do a join on them.
Select t1.field4, t2.field4 , t1.field5, t2.field5
from table1 t1 inner join table2 t2 on t1.field1 =t2.field1 and t1.field2=t2.field2 AND t1.field3=t2.field3
--You can update your table1 with following code:
Merge table1 t1
using table2 t2 on
on t1.field1 =t2.field1 and t1.field2=t2.field2 AND t3.field3=t2.field3
When matched then
Update Set
t1.field4= t2.field4
,t1.field5 = t2.field5 ; -
How to find structural differences between two tables?
I want to find the difference in structure between objects in two 11g databases:
Here I want to identify:
tables/ Views with same columns, same datatype, precision and constraints
Identify if the same indexes and triggers are present.
I do not want to compare the data.
can someone give suggestions on this please?my first resource for SQL Developer questions is (That) Jeff Smith: http://www.thatjeffsmith.com/archive/2012/09/sql-developer-database-diff-compare-objects-from-multiple-schemas/.
-
How to find common columns from two tables
regards
812809 wrote:
regardsHi,
Use User_tab_cols view to extract the result.
Try
SQL> create table test3(id number(10),name varchar2(10));
Table created.
SQL> create table test4(id number(20),addr varchar2(200));
Table created.Now query user_tab_cols
SQL> select column_name from user_tab_cols where table_name='TEST3'
2 intersect
3 select column_name from user_tab_cols where table_name='TEST4'
4 /
COLUMN_NAME
IDHope this helps
Regards,
Achyut
Ps-> Mark as Complete/Answered if it meets your requirement -
Filemaker-how to match and flag records in two tables
Hello,
Tiger.8
Filemaker Pro 8.5 Advanced
I have two related tables in an FMP file.
Table A has ~300 records, B ~2,000.
Each record in A is unique for sure; I believe each one in B is unique.
The goal is to determine whether any of the records in B match one in A based upon student ID.
These IDs are like social security numbers; i.e., they are preassigned, unique 9-character values rather than ones that I'm assigning within FMP.
Like SSNs, these IDs are unique. So within Table A, each ID is unique. Likewise, within B the IDs are unique.
However, some IDs in A might also be in B. I need to find out programmatically which ones, if any, are in both tables.
If a match exists, I need to flag a field in each table.
I found and modified an AppleScript that someone else wrote.
The original is as follows.
tell application "FileMaker Pro"
activate
show every record of database "Original Database"
show every record of database "Old Database"
set field "Match" of document "Original Database" to ""
set orgList to field "Full Name" of document "Original Database"
set oldList to field "Full Name" of document "Old Database"
set matchList to field "Match" of document "Original Database"
repeat with i from 1 to (count of orgList)
if oldList contains item i of orgList then
set item i of matchList to "Match"
end if
end repeat
set field "Match" of document "Original Database" to matchList
show (every record of database "Original Database" whose cell "Match" = "Match")
sort layout 2 of document "Original Database" by field "Last Name"
show layout 2 of document "Old Database"
end tell
My revision is as follows.
tell application "FileMaker Pro Advanced"
activate
show every record of table "A" of document "test"
show every record of table "B" of document "test"
set field "flag" of table "A" of document "test" to ""
set field "flag" of table "B" of document "test" to ""
set AList to field "ID" of table "A" of document "test"
set BList to field "ID" of table "B" of document "test"
set flagList to field "flag" of table "A" of document "test"
repeat with i from 1 to (count of AList)
if BList contains item i of AList then
set item i of flagList to "flag"
end if
end repeat
set field "flag" of table "A" of document "test" to flagList
set field "flag" of table "B" of document "test" to flagList
show (every record of database "test" whose cell "flag" = "flag")
sort layout 1 of document "test" by field "ID"
show layout 1 of document "test"
end tell
I sort of understand what each of the above commands does, but would appreciate answers to the following questions.
1. How come a test record that I created in A and B that has bogus ID 1234 does not get flagged by the above revised script, but other records with valid matching IDs in both A and B do get flagged?
2. How come all records in A that got flagged by the revised script do have counterparts in B, but only some of the ones in B that have a match in A got flagged?
3. How do the commands "set Alist" and "set Blist" function?
4. How do I fix the revised script so that it properly, correctly matches IDs between A and B, then properly, correctly flags the records in A and B that have matching IDs?
Many thanks in advance and happy weekend!
G4/1.25 MDD Mac OS X (10.4.8)>
as there any way find out using comparison same records in two tables..........
>
>
if i write a query then i can easily understand the same data is existed in two tables
>
So, what is your problem now?
You can join both the tables using a simple query and get the records.
select e1.empname, e2. empname from emp1 e1, emp2 e2 where
e1.empname = e2.empname and e1.empid = e2.empid -
How to insert some records in one table and some records in another table
Interview question
how insert records in two tables by using trigger
CREATE or REPLACE TRIGGER Emp_Ins_Upd_Del_Trig
BEFORE delete or insert or update on EMP
FOR EACH ROW
BEGIN
if UPDATING then
UPDATE emp2
SET
empno = :new.empno,
ename = :new.ename
--, job = :new.job
--, mgr = :new.mgr
--, hiredate = :new.hiredate
, sal = :new.sal
--, comm = :new.comm
--, deptno = :new.deptno;
sdate = :new.sdate,
edate = :new.edate
end if;
if INSERTING then
INSERT INTO emp2
VALUES
( :new.empno
, :new.ename
--, :new.job
--, :new.mgr
--, :new.hiredate
, :new.sal
--, :new.comm
--, :new.deptno
new.sdate,
new.edate);
end if;
if DELETING then
DELETE FROM emp2
WHERE empno = emp2.empno;
end if;
END;
it is working fine but he wants to insert some specific litimit on one table and some specified limit of records in one ..
In this senerio can i insert records by use count of records...
please help me..Can you be more specific on the "Limit"
Conditional insert can be used in this case. -
How to find latest entry in the table according to time
how to find latest entry in the table according to the time
is there any function module to do so
\[removed by moderator\]
Regards
Shashi
Edited by: Jan Stallkamp on Aug 25, 2008 4:39 PMHi,
If you want to read the entry from an internal table,
sort the internal table in the descending order by the time and
delete adjacent duplicates by comparing the fields other than time and the internal table will have the latest record.
Suggestion: instead of only time try to have one more field called date with the time combination
Regards,
Ramesh -
How can i fetch records from 3 tables in a single query without using join
Hi.
Can any body please tell me <b>How can i fetch records from 3 tables with a single query without using joins</b>
Thanx
prabhuduttaHi Prabgudutta,
We can fetch the data by using the views concept.
Go throuth this info we can know the how to create view and same like database table only we can fetch the data.
Views conatin the data at runtime only.
Four different view types are supported. These differ in the
way in which the view is implemented and in the methods
permitted for accessing the view data.
Database views are implemented with an equivalent view on
the database.
Projection views are used to hide fields of a table (only
projection).
Help views can be used as selection method in search helps.
Maintenance views permit you to maintain the data
distributed
on several tables for one application object at one time.
step by step creation of Maintenance view:
With the help of the table maintenance generator, you are able to maintain the ENTRIES of the table in SM30 transaction.
It can be set in transaction SE11 - Tools - Table maintenance generator.
Table maintanance Generator is used to manually input values using transaction sm30
follow below steps
1) go to se11 check table maintanance check box under attributes tab
2) utilities-table maintanance Generator-> create function group and assign it under
function group input box. Also assign authorization group default &NC& .
3) select standard recording routine radio in table table mainitainence generator to move table
contents to quality and production by assigning it to request.
4) select maintaience type as single step.
5) maintainence screen as system generated numbers this dialog box appears when you click on create button
6) save and activate table
One step, two step in Table Maintenance Generator
Single step: Only overview screen is created i.e. the Table Maintenance Program will have only one screen where you can add, delete or edit records.
Two step: Two screens namely the overview screen and Single screen are created. The user can see the key fields in the first screen and can further go on to edit further details.
SM30 is used for table maintenance(addition or deletion of records),
For all the tables in SE11 for which Table maintenance is selected , they can be maintained in SM30
Sm30 is used to maintain the table ,i.e to delete ,insert or modify the field values and all..
It creates the maintenance screen for u for the aprticular table as the maintenance is not allowed for the table..
In the SE11 delivery and maintenance tab, keep the maintenance allowed..
Then come to the SM30 and then enter the table name and press maintain..,
Give the authorization group if necessary and give the function group and then select maintenance type as one step and give the screen numbers as system specified..
Then create,,,
Then u will able to see the maintenance view for the table in which u can able to insert and delete the table values...
We use SM30 transaction for entering values into any DB table.
First we create a table in SE11 and create the table maintenance generator for that Table using (utilities-> table maintenance generator) and create it.
Then it will create a View.
After that from SM30, enter the table name and Maintain, create new entries, change the existing entries for that table.
Hope this resolves your query.
Reward all the helpful answers.
Rgds,
P.Naganjana Reddy -
How to find a record then edit using sql server management studio
Hello,
A very basic question:
I want to find a record stored in MS SQL Server 2008 express database table then edit the record.
I tried to do it using SQL Server 2008 management studio express because I have been using MS Access database all the time. I have right clicked the table in management studio, clicked the "Edit top 200 records" menu item then when records were
displayed on the result pane, I pressed Ctrl + F key to find a student named Simon for example. Well, nothing happened. I couldn't see any dialog boxes for putting in the search criteria.
I guess I cannot simply use Ctrl+F in SQL Server management studio to find / edit a record.
Can someone please teach me how to find a record specifying a search criteria then edit the record in SQL server management studio?Hi ZKM128,
I have not seen Ctrl+F to be used to look for desired rows in Sql server.
On the result pane after you selected "Edit top 200 records", just right click , select
PANE, SQL, you will get the T-Sql query t,here you need to mention the exact criteria which you are looking for, and then you will get the desired rows and then you can edit.
Thanks
Manish
Please use Marked as Answer if my post solved your problem and use
Vote As Helpful if a post was useful. -
How to find the deleted data in tables
guys,
how to find the deleted data in tables example: i want to see whether anyone deleted data in MB5B report tables like mbew, etc.,
regards,Hi,
MBEWH is actually the history table of MBEW. It will record all the changes. As I have told you earlier if you have deleted the record dirctly from the table then it will not come even in the table MBEWH
That means no changes have been made.
regards
Maybe you are looking for
-
HP8600 all in one - scanner suddenly won't scan in color to my mac os 10.5.8.
How do I remedy? thx!
-
Transfer songs from older library to current library
Hello I have songs on my 2nd Generation model 1GB Shuffle that are associated with a library that is no longer usable due to computer reformat. How, or can I, transfer the non purchased songs from the Shuffle, to my current iTunes library? When I con
-
Camera Raw 6.4 RCs availailable
Camera Raw 6.4 and Lightroom 3.4 Release Candidates (RC's) are available for download and testing from http://forums.adobe.com
-
External USB3 HDDs keeping trying to spin up while iMac is asleep
I recently added 2x My Book Studio 3TB USB 3.0 HDDs to my iMac. I set them up in a RAID 1 configuration using Disk Utility and I am using the resulting 3TB array for Time Machine backups. Everything seems to be working fine, with one exception: When
-
Dualphone 3088.1 Handset and Receiver 3088.2
Dear All, I just bought an extra handset model 3088 to replace to current one that I have. I bought it trough Amazon, sold by Chat and Vision, and received it ok. When I tried to register, it never registered, and then after some googling I found out