1.select * from xx
查询结果:总共142条
2.select * from xx where YearMonth like ‘%%’
查询结果:只有1条
3.select * from xx where isnull(YearMonth,’’) like ‘%%’
查询结果:142条
结论:用 like ‘%%’ 查询不能查出为NULL的数据,需改成 isnull(要查的字段,’’) like '%%'
1.select * from xx
查询结果:总共142条
2.select * from xx where YearMonth like ‘%%’
查询结果:只有1条
3.select * from xx where isnull(YearMonth,’’) like ‘%%’
查询结果:142条
结论:用 like ‘%%’ 查询不能查出为NULL的数据,需改成 isnull(要查的字段,’’) like '%%'