我在查询中创建了一个工作联盟。
SELECT tblGlass.Address, tblGlass.Quantity, tblGlass.Width, tblGlass.Height,
tblGlass.Thickness, tblGlass.Finish
FROM tblGlass
WHERE tblGlass.Ordered=No;
UNION SELECT tblSeansGlass.Address, tblSeansGlass.Quantity,
tblSeansGlass.Width, tblSeansGlass.Height, tblSeansGlass.Thickness,
tblSeansGlass.Finish
FROM tblSeansGlass
WHERE tblSeansGlass.Ordered=No;
我现在想要在两个表中添加一个模块,这需要付出代价:
GlassPrice([Width],[Height],[Thickness],[Quantity],[Finish]) AS [Glass Price]
所以最终的代码如下:
SELECT tblGlass.Address, tblGlass.Quantity, tblGlass.Width, tblGlass.Height,
tblGlass.Thickness, tblGlass.Finish, GlassPrice([Width],[Height],
[Thickness],[Quantity],[Finish]) AS [Glass Price]
FROM tblGlass
WHERE tblGlass.Ordered=No;
UNION SELECT tblSeansGlass.Address, tblSeansGlass.Quantity,
tblSeansGlass.Width, tblSeansGlass.Height, tblSeansGlass.Thickness,
tblSeansGlass.Finish, GlassPrice([Width],[Height],[Thickness],[Quantity],
[Finish]) AS [Glass Price]
FROM tblSeansGlass
WHERE tblSeansGlass.Ordered=No;
然而,我收到错误:
“条件表达式中的数据类型不匹配。”
答案 0 :(得分:0)
感谢Andre的评论,我发现问题的根源是tblSeansGlass中的半填充条目。删除此条目解决了这个问题。再次感谢安德烈!