DISTINCT function

  • Thread starter Thread starter Ryan
  • Start date Start date
R

Ryan

I am running a query that gives me each distinct project
listed in a database....Is there a way I can extend this
query to include multiple tables and drop this data into a
new table? for example:

I would like to select each distinct project in the
following tables (these tables will repeat projects
within them and between them as well):
Table1
Table2
Table3

I would also like to use this data to creat a new table
using the INSERT INTO function.


Thanks for any advice you can offer,
Ryan
 
You might use a UNION query whose SQL looks something like this:

SELECT [Table1].[Project] FROM [Table1]
UNION SELECT [Table2].[Project] FROM [Table2]
UNION SELECT [Table3].[Project] FROM [Table3]

By default, a union query returns only distinct (combinations of) values,
which is what you want.
 
Back
Top