子查询

时间:2016-07-02 05:13:24

标签: sql ms-access

我尝试获取MS Access查询,根据他们的总积分显示我的数据集中的前3名运动员。总分与运动员和他们的信息在不同的表格中,这使我很难,因为我是一个菜鸟。我有这个代码,我认为应该有用;

SELECT [m].ChildsName, [m].MembershipType, [r].TotalPoints
FROM [Members] AS m, [Results] AS r
WHERE ([m].[MembershipType]) In 
   (SELECT TOP 3 [m].MembershipType 
    FROM [Members], [Results]
    WHERE ChildsName = m.ChildsName
    ORDER BY [r].TotalPoints DESC, [m].MembershipType)
ORDER BY [m].ChildsName, [r].TotalPoints DESC , [m].MembershipType;

唯一的问题是它不起作用。它会带来错误: 子查询'[m] .MembershipType'

中的备注,OLE或超链接对象无效

所有这些东西都来自2个表,成员和结果

0 个答案:

没有答案