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.
Author |
Topic |
Mondeo
Constraint Violating Yak Guru
287 Posts |
Posted - 2010-08-20 : 09:52:26
|
Hi,I have this WHEREWHERE (CapID NOT IN(SELECT CapID FROM dbo.tblLOAdhoc)) AND (Source <> 'SPC') AND (AdditionalFreeText NOT LIKE '%metallic%')I want both the last two to be true, not one or the other. But when I add extra brackets like below it removes them and runs the query although they are seperateWHERE (CapID NOT IN(SELECT CapID FROM dbo.tblLOAdhoc)) AND ((Source <> 'SPC') AND (AdditionalFreeText NOT LIKE '%metallic%'))Thanks |
|
Mondeo
Constraint Violating Yak Guru
287 Posts |
Posted - 2010-08-20 : 09:54:24
|
To be clear, i'd like to include results where for example Source = 'SPC' and additionalfreetext ='solid'Thanks |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-08-20 : 10:11:26
|
WHERE (CapID NOT IN(SELECT CapID FROM dbo.tblLOAdhoc)) AND (Source = 'SPC' and additionalfreetext ='solid')MadhivananFailing to plan is Planning to fail |
 |
|
Mondeo
Constraint Violating Yak Guru
287 Posts |
Posted - 2010-08-20 : 10:17:26
|
Hi,That wouldn't work, I want to show everything except records where(Source = special AND additionalfreetext contains 'metallic')Thanks |
 |
|
Mondeo
Constraint Violating Yak Guru
287 Posts |
Posted - 2010-08-20 : 10:18:10
|
Sorry, by special I meant source='spc' |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-08-20 : 12:18:03
|
WHERE (CapID NOT IN(SELECT CapID FROM dbo.tblLOAdhoc)) AND NOT (Source = 'SPC' and additionalfreetext ='solid')------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|