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 / General 2 / May 2007

Tip: Looking for answers? Try searching our database.

simple question i think

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lebowski - 21 May 2007 07:42 GMT
Hi,

i have two tables, that contains data in two columns. I want to
display only these rows from Table A that do not exist in Table B.
Rows are considered equal if data in both columns are equal.

I have an idea how to to it, but its too complex (needs at least 3
queries). I wonder if there's a possibility to do it using only one
query.

Thanks for help
scubadiver - 21 May 2007 07:54 GMT
"find unmatched" query?

Signature

http://www.patriotsquestion911.com
http://www.911truth.org
http://www.wtc7.net
http://www.st911.org
http://www.journalof911studies.com
http://www.pilotsfor911truth.org
http://ae911truth.org

> Hi,
>
[quoted text clipped - 7 lines]
>
> Thanks for help
Lebowski - 21 May 2007 10:07 GMT
On 21 Maj, 08:54, scubadiver <scubadi...@discussions.microsoft.com>
wrote:
> "find unmatched" query?

The problem with "Find Unmatched" query is that the data in both
tables is in two columns and this query compares data from only one
column. I need a query that exclude rows if the whole data in the rows
is the same.
scubadiver - 21 May 2007 10:28 GMT
Can you provide more details about the two tables? I will try to help if I
can.

> On 21 Maj, 08:54, scubadiver <scubadi...@discussions.microsoft.com>
> wrote:
[quoted text clipped - 4 lines]
> column. I need a query that exclude rows if the whole data in the rows
> is the same.
Lebowski - 21 May 2007 11:04 GMT
On 21 Maj, 11:28, scubadiver <scubadi...@discussions.microsoft.com>
wrote:
> Can you provide more details about the two tables? I will try to help if I
> can.

both TABLE A and TABLE B have columns SUPPLIER, CODE

the problem is that the same supplier can have different codes in the
tables, for example:

in TABLE A there is "Supplier One" with code "125"
and
in TABLE B there is "Supplier One" with code "345"

because the codes are different i should get two entries in my
"Unmatched Query": Supplier One/125 and Supplier One/345

What i want to get i would call "Include ALL records from TABLE A and
only those records from TABLE B where the joined fields ARE NOT equal"
scubadiver - 21 May 2007 11:28 GMT
The simplest idea I have is that you simply subtract one code from the
other. If the difference does not equal zero then exclude the record.

Is "supplier one" the same in both tables? If so why not have one table for
"supplier" and one table for "code" so you have a 1-to-many relationship?

I think you may have created some difficulty for yourself with the design.

> On 21 Maj, 11:28, scubadiver <scubadi...@discussions.microsoft.com>
> wrote:
[quoted text clipped - 15 lines]
> What i want to get i would call "Include ALL records from TABLE A and
> only those records from TABLE B where the joined fields ARE NOT equal"
BruceM - 21 May 2007 12:49 GMT
Your last sentence describes a query that includes both tables.  In query
design view, right click the join line, click Join Properties, and choose
the appropriate join type.

However, I don't think that is quite what you need.  I agree that your
structure may be part of the problem.  Supplier should be stored in one
table.  Codes associated with that supplier should be stored in a related
table.  That way you could have any number of codes, and retrieving the list
would be a simple matter.

Having said that, if the only two fields you need are Supplier and Code you
could use SELECT DISTINCTROW instead of SELECT in the query's SQL.  In query
design view, click View > Properties, and set Unique Records to Yes.

> On 21 Maj, 11:28, scubadiver <scubadi...@discussions.microsoft.com>
> wrote:
[quoted text clipped - 16 lines]
> What i want to get i would call "Include ALL records from TABLE A and
> only those records from TABLE B where the joined fields ARE NOT equal"
Larry Linson - 21 May 2007 21:23 GMT
The following works when there is only one record with a given Supplier and
Code in each table... as would be the case if the combination of Supplier
and Code were defined at the Primary Key, or as a Unique Index.  Other
configurations may require a different approach.

In the Query Builder add TABLE A and TABLE B to a new Query.  Drag and drop
to join the SUPPLIER field, and do the same for the CODE. Click each of the
join lines, choose Join Properties, and choose "All records from Table A and
only those that match from Table B".  In the query grid, drag down the
SUPPLIER and CODE fields from each Table.  In the first criteria line under
the SUPPLIER and CODE from Table B, enter Is Null (criteria on the same line
are AND conditions). And, if you don't want the empty Fields to display on
the Query, uncheck the Show box on each of these two Fields, also.

Larry Linson
Microsoft Access MVP

> On 21 Maj, 11:28, scubadiver <scubadi...@discussions.microsoft.com>
> wrote:
[quoted text clipped - 16 lines]
> What i want to get i would call "Include ALL records from TABLE A and
> only those records from TABLE B where the joined fields ARE NOT equal"
 
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.