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 / SQL Server / ADP / December 2005

Tip: Looking for answers? Try searching our database.

select identical and unique rows in different tables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sander Caerteling - 12 Dec 2005 22:07 GMT
I have a database system of three table consisting of partly identical
information.
Now I want a few things:
-I want to select the rows from the tables that are present in all three
tables.
-I want to select the rows from the tables that are present in two tables
and not in the other one.
-I want to select rows that are unique to table 1

Can you help me with the SQL statements that make these selections, because
I don't seem to get it working....
And also, is it possible (in Microsoft Access) to combine these SQL
statements in one big querie?

Many Thanks!
Sander

Signature

---------------------------------------------------

Sylvain Lafontaine - 13 Dec 2005 06:31 GMT
These kind of queries are usually solved by using an INNER JOIN, an Outer
Join, the IN, the Not IN, the EXISTS (...) or the NOT EXISTS (...)
operators.  Finally, you can combine all these queries by using the UNION
operator.  However, with Access, you cannot use the Query Designed in
graphic mode when you want to use the UNION operator.

This looks like a school assignement?

You don't give us any schema information, so it's hard to give you some
examples; however, here are some:

Select * From Table1 where Table1.Id not In (Select Distinct Id from Table2
Where Table2.Id is not Null)

Select * From Table1 where Not Exists (Select * from Table2 where Table2.Id
= Table1.Id)

Signature

Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF

>I have a database system of three table consisting of partly identical
> information.
[quoted text clipped - 13 lines]
> Many Thanks!
> Sander
 
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.