Advertisement

09.25.2008 at 02:54PM PDT, ID: 23764451
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

Help me make a SQL Query work properly

Asked by HelderConde in SQL Query Syntax, SQL Server 2005, SQL Server 2008

Tags: , ,

Dear colleagues,

I have two queries (shown below) that have different results and I simply cannot understand why that's happening. Perhaps a brighter brain can shed some light into this.

What I want to do is to make a query that will show me all Names from the Users table, which are *not* on the DeletedUsers table. Pretty simple, huh?

Let's say I have 1000 names on the Users table and I have 100 names on the DeletedUsers table.


/* QUERY 1 - USING LEFT OUTER JOIN */
SELECT DISTINCT Users.Name
FROM Users
      LEFT OUTER JOIN DeletedUsers
            On Users.Name <> DeletedUsers.Name



/* QUERY 2 - USING "NOT IN" */
SELECT DISTINCT Users.Name
FROM Users
WHERE Users.Name
NOT IN (SELECT DISTINCT DeletedUsers.Name FROM DeletedUsers)



In theory, both queries should return 900 names, right? However, for some reason, query 1 (the one with Left outer join) returns all 1000 names.

Could this be due to the fact that I'm using a "<>" at the "On" clause? Does JOIN clauses require "="? As a matter of fact, using either "<>" or "=" will provide the very same results...

I'm using SQL 2005 Standard.

Could someone help me get this figured out? Thanks in advance,

Helder CondeStart Free Trial
[+][-]09.25.2008 at 03:07PM PDT, ID: 22574381

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.25.2008 at 03:17PM PDT, ID: 22574459

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.25.2008 at 03:20PM PDT, ID: 22574474

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.25.2008 at 03:22PM PDT, ID: 22574495

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.25.2008 at 03:33PM PDT, ID: 22574603

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.25.2008 at 03:45PM PDT, ID: 22574744

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.25.2008 at 03:50PM PDT, ID: 22574781

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.25.2008 at 03:52PM PDT, ID: 22574792

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Query Syntax, SQL Server 2005, SQL Server 2008
Tags: Microsoft, SQL Server, 2005
Sign Up Now!
Solution Provided By: 3abqari
Participating Experts: 3
Solution Grade: A
 
 
[+][-]09.25.2008 at 04:58PM PDT, ID: 22575151

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.25.2008 at 07:54PM PDT, ID: 22576226

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.26.2008 at 02:53AM PDT, ID: 22577919

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_2_20070628