troubleshooting Question

MS SQL query

Avatar of kajalg
kajalg asked on
Microsoft SQL Server
6 Comments1 Solution343 ViewsLast Modified:
Hi all,
I want to perform an intersection or minus operation in Ms SQL.
I was trying the following:

(select language.language from language)
(select language.language
from language,user,user_language
where = user_language.user_id
and = user_language.lang_id)

The table structures are:
         id          varchar      primary key
         name     varchar
         id           varchar     primary key
         language varchar
        user_id    varchar
        lang_id    varchar

It's working fine if I give replace intersect with union. But for intersect it's giving the following error:

Server: Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'intersect'.

But I need to do the intersect operation. Does MS SQL not support intersect or my query is wrong.
Pls help
Thanks in advance
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros