Hi,
Please excuse the newbie type question, but I am wracking my brains to
solve what should be a simple query.
I have three fields in a table F1, F2, F3. Any of the fields may
contain duplicate data, but I am only interested in where only the
first two fields match. I want to query and get only the records (all
three fields) where there are duplicates in the first two fields, e.g.
F1 F2 F3
1 2 3
1 2 4
1 2 4
2 3 4
2 3 4
Would return only, 1 2 3, 1 2 4 (because there are more than one row
with 1 2) and not any of the records with 2 3.
Hope this comes out clear.
Thanks in advance
Steve in UK 2 5696
"steevp" <st******@hotma il.com> wrote in
news:11******** *************@g 14g2000cwa.goog legroups.com: Hi,
Please excuse the newbie type question, but I am wracking my brains to solve what should be a simple query.
I have three fields in a table F1, F2, F3. Any of the fields may contain duplicate data, but I am only interested in where only the first two fields match. I want to query and get only the records (all three fields) where there are duplicates in the first two fields, e.g.
F1 F2 F3 1 2 3 1 2 4 1 2 4 2 3 4 2 3 4
Would return only, 1 2 3, 1 2 4 (because there are more than one row with 1 2) and not any of the records with 2 3.
Hope this comes out clear.
Thanks in advance Steve in UK
In the query, put two instances of the table. It will show the
table names as TableName and TableName_1. Right click on each
name and set the alias property to A on one table and B on the
other.
Join A.F1 to B.F1, A.F2 to B.F2. Set the criteria for a.F3 <>
B.F3
You will still have a problem with your two instances of 1-2-4,
which you can resolve by adding a criteria on the primary key
(which you have not shown) being different.
--
Bob Quintal
PA is y I've altered my email address.
Thanks Bob!
Just the job. Adding a DISTINCT got rid of the other duplicates. The
code is as below for reference:
SELECT DISTINCT A.F1, A.F2, A.F3
FROM table1 AS A INNER JOIN table2 AS B ON (A.F1 = B.F2) AND (A.F2 =
B.F2)
WHERE (((A.F3)<>b.F3) );
regards This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brian |
last post by:
I'm trying to find a way to search multiple tables for the same record.
Say I have 3 tables all with a name column, I need to search all 3
tables and find matching names. Is there an easy way to accomplish this?
|
by: Jameel |
last post by:
how do i find duplicate records in ASP.net/ADO.net , i know how to do it in
classic asp, anything appreciated code,tutorial links etc..
(if rs.eof then
add record
else
error message
end if
)
|
by: Carroll |
last post by:
I'm looking for a way in SQL to find duplicate records in a single
table, that are the same based on 3 columns, regardless of what is in
the other columns in the duplicate records. I would like to keep both
records (or it could be more than 2 as well) where duplicate records
are found. Also, I am interested in selecting all columns from the
duplicate records.
Thanks,
Carroll Rinehart
|
by: rgurganus |
last post by:
I'm trying to setup a way to find possible duplicate or near-duplicate
records of contact people. I have a table of 50k records doing an
inner join with itself, something like this:
SELECT p1.fields, p2.fields
FROM table AS p1 INNER JOIN table AS p2 ON p1.lastname = p2.lastname
WHERE p1.id <p2.id AND
(other criteria)
The id and name and other criteria fields are indexed as well as they
|
by: nethravathy |
last post by:
Hi,
The following table namely elcbtripselect contains 5147 records.I want to know wether this table contains duplicate records or not.
I tried with following query
1)SELECT elcbtripselect.ELCBTRIP_voltsMIN, elcbtripselect.ELCBTRIP_voltsMAX, elcbtripselect.ELCBTrip_is_partwinding, elcbtripselect.ELCBTrip_is_ydelta, elcbtripselect.ELCBTRIP_starter_size, elcbtripselect.ELCBTRIP_UnitFunction, elcbtripselect.ELCBTRIP_strcb_speedi_frame_ty,...
| |
by: Sheol |
last post by:
Hello everyone! Can somebody please help me with this... I have a VB program that inputs Name and Address. I've made a database in MS Access using ADO Control:
Table Name: Contacts
Fields are: ID, CompanyName, CompanyAddress
My only problem is that how can I find duplicate entries in the CompanyName field. I have an ADD command button when adding new Company Name from a textbox. What I would like to do is that before the program add the...
|
by: Thomas Arthur Seidel |
last post by:
Hello to all,
I have a small or big problem with a customer data base, where during a change of
system we might have created duplicate records. This should be easy to find, you
might think, but, we are talking about roughly 10000 records or less in a total
volume of 1 MIO records or more.
I have considered a strategy: The station ID and a field with something like a
sequence number are supposed to be unique during that period. The...
|
by: nomvula |
last post by:
hi guys
i need some help to duplicate records on my form datasheet:
here's the example of my form results:
ClientLookup DateCaptured ForecastDate Description ForecastQuantity Forecast Actual
UJ 18-Apr-08 01-Mar-08 Fees: Asset 1 R 31,200.00 R 31,200.00
NMBM 22-Apr-08 23-Mar-08 P-MI (E) 07/2006 3 R 47,485 R 38,849
i have 200 records deplayed in the form i'm using access2007 and i have a command button which is the built in command button to...
|
by: anantha raman |
last post by:
Hai,
I am a beginer in Developing ASP.NET webpage.
I want to restrict duplicates while uploading the excel data and to inform the user that the perticular cell in excel contains duplicate value which is already exist in Sql Database.(Duplicates should be check in Excel (EMP_ID) against SQL (EMPLOYEE_ID)
SQL DATABASE
Table : Employees
FiledName:EMPLOYEE_ID
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |