3

如何在 Sqlite 中仅获得 10 条 Nemayeh.Nemayeh 字段的第一条记录?

SELECT
  Keyword,
  Nemayeh.Nemayeh

FROM
  (SELECT
     Keyword.Id,
     Keyword.Keyword
   FROM Keyword
   ORDER BY Keyword.Keyword ASC
   LIMIT 10 OFFSET 0
  ) AS tmp

INNER JOIN KeyWord_Nemayeh
        ON KeyWord_Nemayeh.Id_Keyword = tmp.Id

INNER JOIN Nemayeh
        ON Nemayeh.Id = KeyWord_Nemayeh.Id_Nemayeh

ORDER BY 1,2

例如 :

Key1 Nem1_1
Key1 Nem1_2
Key1 Nem1_3
.
.
.
Key1 Nem1_10
Key2 Nem2_1
Key2 Nem2_2
.
.
.
Key2 Nem2_10
4

2 回答 2

2

这几乎是 biziclop 所说的,但应该可以。

SELECT
  Keyword,
  Nemayeh.Nemayeh
FROM
  (SELECT Keyword.Id,Keyword.Keyword 
   FROM Keyword
   ORDER BY Keyword.Keyword ASC
   LIMIT 10 OFFSET 0) AS tmp

INNER JOIN KeyWord_Nemayeh ON KeyWord_Nemayeh.Id_Keyword = tmp.Id

INNER JOIN Nemayeh ON Nemayeh.Id = KeyWord_Nemayeh.Id_Nemayeh

ORDER BY 1,2 LIMIT 0, 10 
于 2012-08-12T12:47:40.377 回答
1

尝试:

SELECT TOP 10 Keyword,... FROM...
于 2012-08-12T12:05:30.377 回答