Microsoft Access 2003 SQL 问题
我需要在 Microsoft Access 中合并多个具有不同结构的表。
例如,我有表:
table1 (column_a,column_b,column_c),
table2 (column_a,column_c),
table3 (column_d)
SQL 如下所示:
SELECT table1 column_a,column_b,column_c, Null as column_d FROM Table1
UNION
SELECT table2 column_a,Null as column_b, column_c, Null as column_d FROM Table2
UNION
SELECT table3 column_a, Null as column_b, Null as column_c, Null as column_d
FROM Table3;
但有时 MS Access 显示有关不兼容类型的错误消息。
我认为这是因为一个 SELECT 中具有空值的生成列的类型与另一个 SELECT 中相应的非自动生成列不兼容
有没有办法指定带有 null 的自动生成列的类型?
I need to union several tables with the different structure in Microsoft Access.
For example I have table:
table1 (column_a,column_b,column_c),
table2 (column_a,column_c),
table3 (column_d)
SQL looks like follows:
SELECT table1 column_a,column_b,column_c, Null as column_d FROM Table1
UNION
SELECT table2 column_a,Null as column_b, column_c, Null as column_d FROM Table2
UNION
SELECT table3 column_a, Null as column_b, Null as column_c, Null as column_d
FROM Table3;
But sometimes MS Access shows the error message about incompatible types.
I think this because of generated columns with null values in one SELECT have the type incompatible with corresponding not autogenerated columns in another SELECT
Is there way to specify type of the autogenerated column with null?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
用空字符串 ('') 替换 Null 怎么样?
例如,
What about replacing the Null's with empty strings ('')?
e.g.,