如何克服与其他表连接联合表的错误 [英] How to overcome the error on join union tables with other table
问题描述
尽管我们试图在一侧的联合表与另一侧的其他表之间进行联接,但是,我们试图在联合表之间加入联合表。
While we try to join between union tables on one side with other table on the other side,
SELECT A.x,B.y FROM ([DataSet.Liad],[DataSet.Livne]) AS A INNER JOIN [DataSet.Names] AS B ON A.ID = B.ID LIMIT 10
我们得到这个错误:
we get this error:
错误:2.1 - 0.0:JOIN不能直接应用于表联合或表通配符函数。考虑将表联合或表通配符函数包装在子查询中(例如SELECT *)。
Error: 2.1 - 0.0: JOIN cannot be applied directly to a table union or to a table wildcard function. Consider wrapping the table union or table wildcard function in a subquery (e.g., SELECT *).
为了解决这个错误,我建议你使用一个View。
将联合查询保存为View,DataSet.LiadLivne:
In order to solve this error I suggest you to use a View. Save this Query of union as a View, DataSet.LiadLivne:
SELECT * FROM [DataSet.Liad],[DataSet.Livne]
使用视图执行原始查询:
Execute the origin query using the view:
SELECT A.x,B.y FROM [DataSet.LiadLivne] AS A INNER JOIN [DataSet.Names] AS B ON A.ID = B.ID LIMIT 10
享受
Enjoy
推荐答案
<你需要写成:
You need to write as:
SELECT A.x,
B.y
FROM
(SELECT A.x
FROM ([DataSet.Liad],[DataSet.Livne])) AS A
INNER JOIN [DataSet.Names] AS B ON A.ID = B.ID LIMIT 10
这篇关于如何克服与其他表连接联合表的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!