union查询的null的问题
access吧
全部回复
仅看楼主
level 1
tzchf 楼主
把mysql语句改到access里,结果出问题了
select 数量 as aa, null as bb from a
union all select null, 数量 from a
可以,但再加一行union,就不对了“标准表达式中数据类型不匹配”
select 数量 as aa, null as bb from a
union all select null, 数量 from a
union all select null, 数量 from a
问题就在第一行的null,好象只能写一个union,那就嵌套,又可以了,麻烦,不知道啥意思。注:access2003版
select 数量 as aa, null as bb from a
union all (select null, 数量 from a
union all select null, 数量 from a)
2017年06月08日 07点06分 1
level 1
tzchf 楼主
再加一列null,嵌套也不行了,不知道哪里问题,导致一个查询搞不定,得写到一张中间表再处理。
select 数量 as aa, null as bb, null as cc from a
union all (select null as aa, 数量 as bb, null as cc from a
union all select null as aa, null as bb, 数量 as cc from a)
2017年06月08日 07点06分 2
level 1
tzchf 楼主
怎么弄
2019年01月04日 04点01分 3
吧务
level 13
多个union 正常都是可以的。检查数据类型
2019年01月04日 04点01分 4
就是因为第一句的null
2019年01月04日 05点01分
level 1
tzchf 楼主
用0代替null是可以的,但无法区分没有还是真的0了
2019年01月04日 05点01分 5
1