473,395 Members | 1,401 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,395 software developers and data experts.

Compare between 2 queries - how to?

Hi:
I'm trying to compare between 2 queries I have run and saved in Access.

The DB contains a list of names, emails.

Query 1 = Returns all names and emails. I named this query "allemails"

Query 2 = Returns all the names with good emails. I named this query
"goodemails"
How do I run a comparison query between the 2 queries to return the bad emails?
Meaning, say "allemails" returned me 10 emails and "goodemails" returned me 6,
there should be a difference of 4.

Please help!!

Thanks.
----------------------------------------
pls reply to speedoflight at cosmo.com
Nov 12 '05 #1
2 9306
It sounds like your 2 queries are based on the same table. If this is
the case then you must have at least 2 fields in this table, a textfield
for the email and a yes/no field for if the email is good or bad

fldEmail fldGoodBad
aa*@a.com 1 (or true)
bb*@b.com 0 (or false)
cc*@c.com 1
dd*@d.com 0
ee*@e.com 1
ff*@f.com 1
gg*@g.com 1
...

In one query if you want to return the emails that are not good, you
simply type 1 in the the criteria section fof fldGoodBad field to return
only the good emails or type 0 if you want to return the bad emails. If
you want to compare the good emails with the bad ones in the same query
you could write a query like this one - it is a little more
sophisticated than the queries above:

SELECT t1.emails, t1.goodbad, t2.emails, t2.goodbad
FROM tblEmails AS t1 LEFT JOIN [select * from tblEmails where goodbad =
false]. AS t2 ON t1.emails = t2.emails;

This query returns all the good and bad emails in t1 and only the bad
emails in t2. Note: t1 and t2 are alias's for the same table. t1
represents the the whole table with good and bad emails and t2
represents the same table but only the bad emails.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #2
Create a new query using Query 1 and LEFT Join Query 2 then select all of
Query 1 where Query 2 is NULL.

"speedoflight" <speedoflight@_REMOVETHISTOREPLY_cosmo.com> wrote in message
news:S4******************@www.newsranger.com...
Hi:
I'm trying to compare between 2 queries I have run and saved in Access.

The DB contains a list of names, emails.

Query 1 = Returns all names and emails. I named this query "allemails"

Query 2 = Returns all the names with good emails. I named this query
"goodemails"
How do I run a comparison query between the 2 queries to return the bad emails? Meaning, say "allemails" returned me 10 emails and "goodemails" returned me 6, there should be a difference of 4.

Please help!!

Thanks.
----------------------------------------
pls reply to speedoflight at cosmo.com

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stephen | last post by:
I have to write a .Net application which can compare SQL Databases including things like: - DB structure, PK's, FK's, indexes and types of indexes i.e. should be able to detect if the same index...
9
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my...
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
1
by: Prakash RudraRaju | last post by:
Hi, I have recently migrated MSAccess Tables (nearly 120) to MySQL. To test successful migration I want to compare all tables. I have linked MySQL tables through ODBC connection. I want to...
8
by: Vincent | last post by:
has any one seen a program to compare mdbs'. I have ran into a few of them, but none seem to really do that job. Basically what I need to do is, take 2 access mdb's and check the differences...
6
by: geronimo_me | last post by:
I have 20 queries that compare fields in one table with fields in another table - the query results are the records that do not match in Table1 and Table2. ie Table1 DOB 28/02/78 Table2 DOB...
11
by: DFS | last post by:
Architecture: Access 2003 client, Oracle 9i repository, no Access security in place, ODBC linked tables. 100 or so users, in 3 or 4 groups (Oracle roles actually): Admins, Updaters and ReadOnly....
1
by: hazz | last post by:
This is what Nick Malik suggested from the c# newsgroup. Now that the hectic workweek is over, I can begin to appreciate what he said and break it down into constituent elements to solve. If anyone...
8
by: Sheldon | last post by:
I just received a 2nd (configured as a dual) monitor but, for Access only, I can't seem to figure out, if it's possible, to view, say, Table1 on one monitor and Table2 on the other monitor. If I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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...
0
marktang
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,...
0
jinu1996
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...
0
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...

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.