表a
id  name
1 111
2 222
3 333

语句:
select a.id,a.name,b.IsEnabled
from 表a a
left join(select IsEnabled = 1) b on a.id = 1

结果:
id name IsEnabled
1 111 1
2 222 null
3 333 null

语句:
select a.id,a.name,IsEnabled = IsNull(b.IsEnabled,0)
from 表a a
left join(select IsEnabled = 1) b on a.id = 1

结果:
id name IsEnabled
1 111 1
2 222 1
3 333 1

为什么会是这样,在我感觉这两种查询出来的结果应该是一样的呀?请高人指教?

请朋友帮我看了一下,他测试是没有问题的,结果我换了一个数据库执行了一下也是没有问题的,那就是那个数据库的问题,更让不不解了。
不知道各位有没有遇到过这样的问题?

相关文章:

  • 2022-01-20
  • 2022-03-01
  • 2022-01-22
  • 2021-12-22
  • 2022-01-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-18
  • 2022-01-12
相关资源
相似解决方案