I'm trying to create a query that finds rows w/ duplicate
"ContactKey s" then finds duplicate "AddressLin e1s" out of the list of
duplicate "ContactKey s." (I tried subqueries but it was really slow)
I am trying to create a new table with only duplicate ContactKey rows,
and then I wanted to use that table to pick out the duplicate
AddressLine1 rows.
****** BEGIN CODE **************
SELECT *
INTO dupContactKeys
FROM Contacts
WHERE ContactKey IN (
SELECT ContactKey
FROM Contacts
GROUP BY ContactKey
HAVING COUNT(*) > 1)
SELECT *
FROM dupContactKeys
WHERE ContactKey IN (
SELECT AddressLine1, Zip
FROM Contacts
GROUP BY AddressLine1, Zip
HAVING COUNT(*) > 1)
ORDER BY ContactKey, TypeKey;
drop table dupContactKeys
****** END CODE *************** **
This of course doesn't work. Please help, as I am going slightly mad!
Dusty 1 1246
In the query-subquery scenario, have you tried:
SELECT C1.*
FROM Contacts AS C1
WHERE EXISTS (
SELECT C2.ContactKey
FROM Contacts AS C2
GROUP BY C2.ContactKey
HAVING C2.ContactKey=C 1.ContactKey AND Count(C2.Contac tKey)>1;)
AND EXISTS (
SELECT C3.AddressLine1
FROM Contacts AS C3
WHERE C3.ContactKey=C 1.ContactKey
GROUP BY C3.AddressLine1
HAVING C3.AddressLine1 =C1.AddressLine 1 AND Count(C3.Addres sLine1)>1;)
ORDER BY ContactKey, TypeKey;
See if this works for you.
"Dusty Reagan" <no*******@yaho o.com> wrote in message
news:5a******** *************** ***@posting.goo gle.com... I'm trying to create a query that finds rows w/ duplicate "ContactKey s" then finds duplicate "AddressLin e1s" out of the list of duplicate "ContactKey s." (I tried subqueries but it was really slow)
I am trying to create a new table with only duplicate ContactKey rows, and then I wanted to use that table to pick out the duplicate AddressLine1 rows.
****** BEGIN CODE ************** SELECT * INTO dupContactKeys FROM Contacts WHERE ContactKey IN ( SELECT ContactKey FROM Contacts GROUP BY ContactKey HAVING COUNT(*) > 1)
SELECT * FROM dupContactKeys WHERE ContactKey IN ( SELECT AddressLine1, Zip FROM Contacts GROUP BY AddressLine1, Zip HAVING COUNT(*) > 1) ORDER BY ContactKey, TypeKey;
drop table dupContactKeys ****** END CODE *************** **
This of course doesn't work. Please help, as I am going slightly mad!
Dusty This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: |
last post by:
If I need to check if a certain value does exist in a field, and return
either "yes" or "not" which query would be the most effestive?
|
by: Surajit Laha |
last post by:
I am firing a query like:
SELECT TaskName, StartDate FROMTasks
WHERE StartDate >= '01-Aug-2003'
Now the result comes as:
TaskName StartDate
--------------------------
Task1 01-Aug-2003
|
by: anthonyberet |
last post by:
I work for an organisation that uses a bespoke document imaging system, the
database of which is an MS sql server.
We have MS Access and already use it for some querying of the database.
The database comprises a large number of distinct cases, which are
differentiated by case reference numbers, in one field (table?) of the
database. Each of these cases may have many documents associated with it,
denoted by the reference number, and these...
|
by: sah |
last post by:
I need some help with the following query:
DECLARE @SRV VARCHAR(20), @date smalldatetime
SET @SRV = (select @@servername)
SET @date = '20040901'
select Srv_Name = @SRV, DB_Name = 'DB_NAME', Table_Name =
'Info_Table', Date_of_Records = @date,
count(*) AS 'Actual Total' ,
|
by: plaztik8 |
last post by:
Hello,
Can someone please help me with a query?
The table looks like this:
BookedRooms
===========
CustomerID RoomID BookDateID
| |
by: Max Harvey |
last post by:
Hi,
I have looked at the example called "Open Parameter queries from code"
from the site http://www.mvps.org/access/queries/qry0003.htm
I made up a test which I though looked pretty close (which I will
paste below)
I have put it on the BeforeUpdate event of a form I am using, but
whenever it is called, I get "Run-time error '13':, Type mismatch
|
by: Rated R1 |
last post by:
I wrote this before in the NGs, so I am going to paste the responses that I got
and see if someone can please help me. Email me and we can set something up as
Id even be willing to pay for your time to get me to learn this procedure:
MY ORIGINAL POST:
I am trying to create a database for my small business. I have typed a bunch
of information in a table in 5 columns (style, mm, karat, quantity, labor
cost). We have different labor...
|
by: d.p. |
last post by:
Hi all,
I'm using MS Access 2003.
Bare with me on this description....here's the situation: Imagine insurance,
and working out premiums for different insured properties. The rates for
calculating premiums are dependant on the country in which the client is in.
Therefore, we have a Country table, with its list of rates, a client table
and then the property table. Getting this is great, works fine, easy!
Problem is, now I need to work out a...
|
by: jjturon |
last post by:
Can anyone help me??
I am trying to pass a Select Query variable to a table using Dlookup
and return the value to same select query but to another field.
Ex.
SalesManID SalesManName
AT Alan Time
|
by: tizmagik |
last post by:
I am having a lot of difficulty generating a CrossTab Query based
report. I have looked online for several tutorials and whatnot but I
have not been able to really find what I'm looking for, nor have I been
able to adapt other people's solutions/tips to fit what I need. If
anyone could please help me with the following it would be really
appreciated, thank you!
I need to generate a Report (say: repCrossTab) that grabs it's data
from the...
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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...
| |