English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

SELECT [Name3] FROM [DataTable3]
INTERSECT
SELECT [Name4] FROM [DataTable4];

I am trying to intersect these two columns in MS-Acess and it is not working. It keeps giving me this error: SYNTAX ERROR IN FROM CLAUSE.

Could it be that INTERSECT is a command for SQL Server only?

I have even tried this code and it's not working:

SELECT [DataTable3].Name3 FROM [DataTable3]
INTERSECT
SELECT [DataTable4].Name4 FROM [DataTable4];




Help!!!!!!!!! Thanks a lot.

2007-01-23 03:45:48 · 6 answers · asked by JiveSly 4 in Computers & Internet Programming & Design

Great Answers!!! Thank you all!!!

2007-01-23 11:45:19 · update #1

6 answers

I believe you will want to use the 'Union' command there.

SELECT [DataTable3].Name3 FROM [DataTable3]
UNION
SELECT [DataTable4].Name4 FROM [DataTable4]

"Similar to the UNION command, INTERSECT also operates on two SQL statements. The difference is that, while UNION essentially acts as an OR operator (value is selected if it appears in either the first or the second statement), the INTERSECT command acts as an AND operator (value is selected only if it appears in both statements)." - from http://www.1keydata.com/sql/sql-intersect.html

I could be wrong, I guess it depends on what you are trying to do. Good luck!

2007-01-23 04:09:30 · answer #1 · answered by Special Ed 5 · 2 0

Yes, INTERSECT is not a command that Access will recognize. What you need to to is an INNER JOIN, specifying the columns on which you want to match. For example:

SELECT [DataTable3].Name3, [DataTable4].Name4
FROM DataTable3 Inner Join DataTable4
ON DataTable3.EmployeeID = DataTable4.EmployeeID;

2007-01-23 03:55:53 · answer #2 · answered by rongee_59 6 · 1 0

Actually it only can be executed in MSSQL 2005, SQL 2000 can not accept it.
You need to use inner join like:

SELECT [DataTable3].Name3
FROM [DataTable3] inner join [DataTable4]
On [DataTable3].Name3 = [DataTable4].Name4;


UNION will make all Names showing for [DataTable3] and [DataTable4]

2007-01-23 10:17:36 · answer #3 · answered by Jason L 5 · 1 0

Without a timestamp of similar, how are you measuring recent active users? Without using some sort of changing column value, the most active users will typically always be listed are the same 3. Relatively. You need to have a timestamp of their last activity, or something to sort the list by. SELECT username FROM users ORDER BY timestamp DESC LIMIT 0,3 Cheers, Gitlez

2016-03-28 22:44:17 · answer #4 · answered by Anonymous · 0 0

I use WHERE... AND...

but Jet Engine of MS Access has no INTERSECT to use.

2007-01-23 04:23:30 · answer #5 · answered by Andy T 7 · 1 0

no intersect use the UNION keyword

2007-01-23 04:29:46 · answer #6 · answered by Slavemaker 1 · 1 0

fedest.com, questions and answers