日期:2014-05-17  浏览次数:20731 次

这样的该如何查询
select
  teacher0_.TeacherId as TeacherId3_,
  teacher0_.Password as Password3_,
  teacher0_.Role as Role3_,
  teacher0_.Name as Name3_,
  teacher0_.Sex as Sex3_,
  teacher0_.Nation as Nation3_,
  teacher0_.Birthday as Birthday3_,
  teacher0_.IdCard as IdCard3_,
  teacher0_.Cataloge as Cataloge3_,
  teacher0_.College as College3_,
  teacher0_.Department as Department3_,
  teacher0_.WorkTime as WorkTime3_,
  teacher0_.Postion as Postion3_,
  teacher0_.Education as Education3_,
  teacher0_.GraduateCollege as Graduat15_3_,
  teacher0_.Profession as Profession3_,
  teacher0_.Speciality as Speciality3_,
  teacher0_.Phone as Phone3_,
  teacher0_.Mobile as Mobile3_,
  teacher0_.qq as qq3_,
  teacher0_.Email as Email3_,
  teacher0_.Fax as Fax3_ 
  from
  project.teacher teacher0_ 
  where
  teacher0_.College="医药信息工程学院" 
  and teacher0_.Department="医药信息工程学院 "
  and teacher0_.Postion="副教授"
  and teacher0_.Education like '%'
  and teacher0_.TeacherId like "000605"
  and teacher0_.Cataloge like '%' 

在最后一行的cataloge中由于数据表的该属性有些有数据,有些没有的用null表示,本人用‘%’这个通配符不成功,请问如何修改该查找语句才能将有数据的和没有数据的都作为查找的条件,但是不要用删掉最后 and teacher0_.Cataloge 这一查找限制

------解决方案--------------------
isnull(teacher0_.Cataloge,"") like '%'
------解决方案--------------------
and nvl(teacher0_.Cataloge,'') like '%'
------解决方案--------------------
and nvl(teacher0_.Cataloge,'') like '%'
------解决方案--------------------
我会这样做:and (Cataloge like ‘%’or Cataloge =null)
什么数据库都可以用