Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Exclude Data

Author  Topic 

rnelsch
Starting Member

31 Posts

Posted - 2012-03-23 : 12:14:20
is there a way to exclude data in a query without using the INNER JOIN? If I know the field has specific values I want to exclude from the query.


Ryan A Nelsch

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-03-23 : 12:19:39
You can use a "NOT IN" or "NOT EXISTS" in the WHERE clause. Don't know what would be best in your scenario without more details.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-23 : 12:19:47
specify in WHERE clause ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

rnelsch
Starting Member

31 Posts

Posted - 2012-03-23 : 12:47:12
The table is CALL and the field is CallType
Right now it looks like this:
Select Call.JobID, Call.CallType, Call.Department, Call.BookedDate,
Call.SchedDate, Call.IsScheduled, LeadSource.LeadSource, Call.DispatchedDate
From LeadSource, Call
Where Call.SchedDate between '3-1-2012' and '3-31-2012'

so could I add/change my WHERE clause to Where Call.SchedDate between '3-1-2012' and '3-31-2012' and Call.CallType <ACSU> (ACSU being the specific value)

Ryan A Nelsch
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2012-03-23 : 13:44:17
where is your join predicate?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page
   

- Advertisement -