第一个()INNER JOIN

时间:2013-11-25 13:21:10

标签: sql ms-access inner-join

SELECT tblT.Tick, First(tblB.BDF) AS FirstOfBDF
FROM tblT INNER JOIN tblB ON tblT.Tick = tblB.Tick
GROUP BY tblT.Tick;

我的访问表(tblB)按Tick排序,然后由BDF排序。为什么它不能检索到正确的数据呢?

1 个答案:

答案 0 :(得分:2)

除非您明确提及Order by,否则无法保证对表进行排序。

select top 1  tblT.Tick, First(tblB.BDF) AS FirstOfBDF
 from FROM tblT INNER JOIN tblB ON tblT.Tick = tblB.Tick
    GROUP BY tblT.Tick
    Order by tblt.Tick ;