Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / March 2008

Tip: Looking for answers? Try searching our database.

Help with query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TotallyConfused - 03 Mar 2008 06:19 GMT
Can someone please explain this query?  Thank you.

SELECT A.[DR CNTY], A.[DR ID], A.[DR NAME], A.[DR PH], A.[DR FX], B.[DR PH],
B.[DR FX]
FROM [Main TRKG TBL] AS A INNER JOIN [Main TRKG TBL1] AS B ON A.ID = B.ID
GROUP BY A.[DR CNTY], A.[DR ID], A.[DR NAME], A.[DR PH], A.[DR FX], B.[DR
PH], B.[DR FX]
HAVING (((B.[DR PH])<>[A].[DR PH])) OR (((B.[DR FX])<>[A].[DR FX]))
ORDER BY A.[DR CNTY], A.[DR NAME];
John Spencer - 03 Mar 2008 12:49 GMT
It appears you have two tables and are trying to find records where DR PH in
the first table is not equal to DR PH in the second table or Where DR FX is
not equal to DR FX in the second table.

It also appears that you are trying to group the results so you return only
one record for these conditions being true.  HOWEVER, assuming that A.ID
(and B.ID) are unique values in the two tables I can see no reason for
grouping the results.

I would expect that you would get the same results with the following query.

SELECT A.[DR CNTY], A.[DR ID], A.[DR NAME]
, A.[DR PH], A.[DR FX], B.[DR PH], B.[DR FX]
FROM [Main TRKG TBL] AS A INNER JOIN [Main TRKG TBL1] AS B
ON A.ID = B.ID
WHERE (((B.[DR PH])<>[A].[DR PH])) OR (((B.[DR FX])<>[A].[DR FX]))
ORDER BY A.[DR CNTY], A.[DR NAME];

Signature

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
.

> Can someone please explain this query?  Thank you.
>
[quoted text clipped - 6 lines]
> HAVING (((B.[DR PH])<>[A].[DR PH])) OR (((B.[DR FX])<>[A].[DR FX]))
> ORDER BY A.[DR CNTY], A.[DR NAME];
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.