A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Comparing queries



 
 
Thread Tools Display Modes
  #1  
Old February 22nd, 2010, 12:57 PM posted to microsoft.public.access.queries
David
external usenet poster
 
Posts: 1,494
Default Comparing queries

Hi,

I am using a database storing equipment for rooms where I have two queries
set up, one listing original equipment and another listing current equipment
for room layouts.

The two queries work fine independantly, but I now want to compare
differences between these where I need to know:

1 - equipment in both original and current rooms.
2 - equipment in original room now missing from current room.
3 - equipment in current room, not required in original room.

Regards,
Dave.
  #2  
Old February 22nd, 2010, 03:24 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Comparing queries

You did not say anything about the table structure so I will go with what you
posted.
Use a union query from your two queries, without an 'ALL' to build a list of
rooms. Left join it to the two queries and then display orignal vs present.
--
Build a little, test a little.


"David" wrote:

Hi,

I am using a database storing equipment for rooms where I have two queries
set up, one listing original equipment and another listing current equipment
for room layouts.

The two queries work fine independantly, but I now want to compare
differences between these where I need to know:

1 - equipment in both original and current rooms.
2 - equipment in original room now missing from current room.
3 - equipment in current room, not required in original room.

Regards,
Dave.

  #3  
Old February 22nd, 2010, 03:40 PM posted to microsoft.public.access.queries
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Comparing queries

Dave -

1. SELECT OrigQry.EquipID, OrigQry.RoomID FROM OrigQry INNER JOIN CurrQry
ON OrigQry.EquipID = CurrQry.EquipID AND OrigQry.RoomID = CurrQry.RoomID;

2. SELECT OrigQry.EquipID, OrigQry.RoomID FROM OrigQry LEFT JOIN CurrQry ON
OrigQry.EquipID = CurrQry.EquipID AND OrigQry.RoomID = CurrQry.RoomID WHERE
CurrQry.EquipID is NULL;

3. SELECT CurrQry.EquipID, CurrQry.RoomID FROM CurrQry LEFT JOIN OrigQry ON
OrigQry.EquipID = CurrQry.EquipID AND OrigQry.RoomID = CurrQry.RoomID WHERE
OrigQry.EquipID is NULL;


--
Daryl S


"David" wrote:

Hi,

I am using a database storing equipment for rooms where I have two queries
set up, one listing original equipment and another listing current equipment
for room layouts.

The two queries work fine independantly, but I now want to compare
differences between these where I need to know:

1 - equipment in both original and current rooms.
2 - equipment in original room now missing from current room.
3 - equipment in current room, not required in original room.

Regards,
Dave.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.