?
Solved

SQL Join - 3 tables

Posted on 2009-04-30
2
Medium Priority
?
185 Views
Last Modified: 2012-05-06
Hello,

I have a complicated SQL request to do (for me, a request with a join is always complicated..).

Here are the tables :

Queue
id_queue (PK)
name

User
id_user (PK)
firstname
lastname
etc...

Agent Member
id_agent_member
id_user
id_queue

I want to select all users (firstname, lastname) that don't belong to a "selected" queue.

Is this clear ? Don't hesitate to ask me questions about that. Can you help me with this SQL request ?

Thanks in advance :-)
0
Comment
Question by:chuchyyy
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 24267743
with XXX being the selected queue:
select u.*
  from user u
 where not exists ( select null from agent_member am where am.id_user = u.id_user and am.id_queue = XXX )

Open in new window

0
 
LVL 2

Author Closing Comment

by:chuchyyy
ID: 31576329
Great ! Thank you Angellll
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question