如何才能在Sqlite中獲得Nemayeh.Nemayeh字段的第10條記錄?如何在sqlite中獲得10條連接表的第一條記錄?
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
所以你想要一個結果表,它至少有10個,但不超過10 ** **不同** Nemayeh.Nemayeh值? (追加'LIMIT 10'到你的查詢將太簡單了:) – biziclop 2012-08-12 12:35:58