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 |
|
Grifter
Constraint Violating Yak Guru
274 Posts |
Posted - 2010-11-23 : 04:10:38
|
HiI have a query with a right outer join between departments and stock as I want to show records that are not in stock (in transit), this means they will not have a department assigned to them and the department is null. I also have a statement in the query to remove a certain department name out of the records as this is not required. The statement is like this:AND dept.dept_name NOT LIKE ('%MyCriteria%')I think I am right in saying this statement will remove null department records as it seems to do when I include it in the query but I want to include these null department values AND restrict this certain dept name. Can you tell me how I might do both things without cancelling the records with null departments out (records in transit)?ThanksG |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-11-23 : 04:20:39
|
| AND (dept.dept_name NOT LIKE ('%MyCriteria%') or dept.dept_name is null)==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
Grifter
Constraint Violating Yak Guru
274 Posts |
Posted - 2010-11-23 : 04:38:32
|
| [code]AND (dept.dept_name NOT LIKE ('%MyCriteria%') or dept.dept_name is null)[/code]Hi NigelFrom an initial run of the query this appears to work - thanks.G |
 |
|
|
|
|
|