473,378 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

how to create sql code not duplicate Record

Hi!
Please help me!
How to create sql code ..
Records from two tables do not match
Thank You!
Table 1
Per1 Per2 Per3
A1 B1 C1
A1 B1 C2
A1 B1 C3
A1 B1 C4
A2 B1 C1
A2 B1 C2
A2 B1 C3
A2 B2 C4
A2 B2 C1
A2 B2 C2
A2 B2 C3

Table 2
Per1 Per2 Per3
A1 B1 C3
A2 B1 C2
A2 B2 C1

Results
Per1 Per2 Per3
A1 B1 C1
A1 B1 C2
A1 B1 C4
A2 B1 C1
A2 B1 C3
A2 B2 C4
A2 B2 C2
A2 B2 C3
Jun 14 '12 #1
1 1497
Mihail
759 512MB
This work on your test data but do more tests to be sure.

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT Table1.Per1, Table1.Per2, Table1.Per3
  2. FROM Table1 LEFT JOIN Table2 ON (Table1.Per3 = Table2.Per3) AND (Table1.Per2 = Table2.Per2) AND (Table1.Per1 = Table2.Per1)
  3. WHERE (((([Table1]![Per1]=[Table2]![Per1]) And ([Table1]![Per2]=[Table2]![Per2]) And ([Table1]![Per3]=[Table2]![Per3])) Is Null))
  4. ORDER BY Table1.Per1, Table1.Per2, Table1.Per3;
Jun 14 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Mark | last post by:
When my form goes to a new record, I have a procedure that copies the last record added to the form's underlying table into the form. The intent is that a series of new records may have the same...
8
by: Ray | last post by:
I have a data input form and need to automatically duplicate the existing record as a new record by clicking a button. The main purpose to duplicate the record is that the new record is very...
1
by: 2D Rick | last post by:
Access2003 in XP If I open a form to a specific record and click on a command button with the following code I get a duplcate record: DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand...
3
by: ammie65 | last post by:
I have been trying to create a purchase order database in Access, and I have been successful in creating all the tables, queries and reports that I need. I have only one issue: I need to copy the...
3
by: rajeshkrsingh | last post by:
Hi friends, Step1- create table duplicate ( intId int, varName varchar(50) ) insert into duplicate(intId,varName) values(1,'rajesh') insert into duplicate(intId,varName) values(2,'raj12')...
6
by: teser3 | last post by:
I have my PHP inserting into Oracle 9i. But how do I prevent duplicate record entries? I only have 3 fields in the insert in the action page: CODE <?php $c=OCILogon("scott", "tiger",...
3
by: mlb992000 | last post by:
I have a form that has a duplicate record command button and I need to create an event that will clear two of the fields once the duplicate record is clicked so that the user will know that it has...
1
by: mlb992000 | last post by:
I have a form that has a duplicate record command button that allows the user to duplicate all information on the form and change two fields. I need to create an event that will clear the two fields...
2
by: Ranma13 | last post by:
Hello, I have a duplicate record check written in VB for a check in/check out database. Here's the pseudocode, written for the BeforeUpdate property on the form: If DCount(search for records with...
3
by: Shane van Heerden | last post by:
Table Fields: ID, Route, Flight1, NewDate1, Flight2, NewDate2, Surname, TagNumber etc. Form Filter Code: If Not IsNull(Me.txtStartDate) Then strWhere = strWhere & "( >= " &...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.