Solved

Access Query

Posted on 2007-04-11
2
200 Views
Last Modified: 2010-03-20
I have a 2 tables that are listed below

Table Name is Current_DRP_Files and the fields are listed below
Dest Loc      
Dest Description      
Item Code      
UPC      
Description      
Active/Inactive      
Code Eff Date      
Code End Date      
Source Loc      
Source Loc Description      
Override Recv Days      
Recv Weeks
Product Group      
BDC

The other Table name is MLS_Data and has the following fields
Dest_Ctry_cd
Dest_Not_used
Dest_LMS_id
Dest_Loc_type
Product_Code
Source_Ctry_cd
Source_not_used
Source_id
Loc_type_cd
ORD
ORW

I want the result to have the following fields.
Current_DRP_Files.UPC,
Current_DRP_Files.[Item Code],
Current_DRP_Files.Description,
Current_DRP_Files.BDC,
Current_DRP_Files.[Product Group],
Current_DRP_Files.[Source Loc],
Current_DRP_Files.[Source Loc Description],
Current_DRP_Files.[Dest Loc],
Current_DRP_Files.[Dest Description],
Current_DRP_Files.[Override Recv Days],
Current_DRP_Files.[Recv Weeks],
MLS_Data.ORD,
MLS_Data.ORW

The comman fields are the following
Current_DRP_Files.[Item Code] = MLS_Data.Product_Code
Current_DRP_Files.[Source Loc] = MLS_Data.Source_Id
(Current_DRP_Files.[Dest Loc] = MLS_Data.Dest_LMS_Id

I want all records where the
Current_DRP_Files.[Override Recv Days] <> MLS_Data.ORD
or
Current_DRP_Files.[Recv Weeks] <> MLS_Data.ORW
0
Comment
Question by:awehme
  • 2
2 Comments
 
LVL 5

Expert Comment

by:sphillips1971
ID: 18892977
SELECT Current_DRP_Files.UPC,
Current_DRP_Files.[Item Code],
Current_DRP_Files.Description,
Current_DRP_Files.BDC,
Current_DRP_Files.[Product Group],
Current_DRP_Files.[Source Loc],
Current_DRP_Files.[Source Loc Description],
Current_DRP_Files.[Dest Loc],
Current_DRP_Files.[Dest Description],
Current_DRP_Files.[Override Recv Days],
Current_DRP_Files.[Recv Weeks],
MLS_Data.ORD,
MLS_Data.ORW
FROM Current_DRP_Files INNER JOIN MLS_Data ON
Current_DRP_Files.[Item Code] = MLS_Data.Product_Code AND
Current_DRP_Files.[Source Loc] = MLS_Data.Source_Id AND
(Current_DRP_Files.[Dest Loc] = MLS_Data.Dest_LMS_Id
WHERE
Current_DRP_Files.[Override Recv Days] <> MLS_Data.ORD
OR Current_DRP_Files.[Recv Weeks] <> MLS_Data.ORW
0
 
LVL 5

Accepted Solution

by:
sphillips1971 earned 500 total points
ID: 18892992
Forgot to take out one of your parenthesis:

SELECT Current_DRP_Files.UPC,
Current_DRP_Files.[Item Code],
Current_DRP_Files.Description,
Current_DRP_Files.BDC,
Current_DRP_Files.[Product Group],
Current_DRP_Files.[Source Loc],
Current_DRP_Files.[Source Loc Description],
Current_DRP_Files.[Dest Loc],
Current_DRP_Files.[Dest Description],
Current_DRP_Files.[Override Recv Days],
Current_DRP_Files.[Recv Weeks],
MLS_Data.ORD,
MLS_Data.ORW
FROM Current_DRP_Files INNER JOIN MLS_Data ON
Current_DRP_Files.[Item Code] = MLS_Data.Product_Code AND
Current_DRP_Files.[Source Loc] = MLS_Data.Source_Id AND
Current_DRP_Files.[Dest Loc] = MLS_Data.Dest_LMS_Id
WHERE
Current_DRP_Files.[Override Recv Days] <> MLS_Data.ORD
OR Current_DRP_Files.[Recv Weeks] <> MLS_Data.ORW
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server 2008 R2 - Updating Table/Fields Documentation 3 71
Query Peformance + mulitple query plans 9 48
Unable to save view in SSMS 21 59
grouping logic 6 49
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now