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 |
|
CoachBarker
Posting Yak Master
170 Posts |
Posted - 2009-04-30 : 14:42:15
|
I have a simple select query, it involves 2 tables and for the life of me it won't work. If i run the same query with parameters it works just fine.SELECT fm_regional_manager.fieldman_number ,fm_fieldman_master.last_name + ' ,' + fm_fieldman_master.first_name AS full_nameFROM fm_regional_manager INNER JOIN fm_fieldman_master ON fm_regional_manager.fieldman_number = fm_fieldman_master.fieldman_numberWHERE (fm_regional_manager.regional_manager = NULL) AND (regional_status = 'I')   here are the tables I am usingFrom this table I should be returning 3 records,it is so simple I just can't see it.Thanks for the helpCoachBarker |
|
|
whitefang
Enterprise-Level Plonker Who's Not Wrong
272 Posts |
Posted - 2009-04-30 : 14:44:42
|
| SELECT fm_regional_manager.fieldman_number ,(fm_fieldman_master.last_name + ' ,' + fm_fieldman_master.first_name) AS full_nameFROM fm_regional_manager INNER JOIN fm_fieldman_master ON fm_regional_manager.fieldman_number = fm_fieldman_master.fieldman_numberWHERE (fm_regional_manager.regional_manager IS NULL) AND (regional_status = 'I')Try that. Also, what is the error? |
 |
|
|
CoachBarker
Posting Yak Master
170 Posts |
Posted - 2009-04-30 : 14:52:24
|
| NO error at all it just doesn't return any rows.That worked, I have a dozen of them running like that why was that one different and need ()?Thanks for the helpCoachBarker |
 |
|
|
whitefang
Enterprise-Level Plonker Who's Not Wrong
272 Posts |
Posted - 2009-04-30 : 14:54:42
|
| Are you sure that there are rows that satisfy the filter clause? |
 |
|
|
whitefang
Enterprise-Level Plonker Who's Not Wrong
272 Posts |
Posted - 2009-04-30 : 15:07:53
|
| I think it might be (fm_regional_manager.regional_manager IS NULL) that fixed your issue (IS NULL instead of = Null). |
 |
|
|
|
|
|