2009-04-28 46 views
0

我使用下面的查詢,顯示在按字母順序排列的數據庫行:SQLite的 - 排序問題

SELECT word_id FROM table1 ORDER BY word ASC 

但我想從表2,在那裏我沒有列「字」和值按table1中的列「word」進行排序。

我想是這樣的:

SELECT word_id FROM table2 ORDER BY table1.word ASC 

預先感謝您。

+0

有一些所謂的「加盟」 ......喜歡看關於它:) – Aziz 2009-04-28 10:51:23

回答

4

你必須用兩個表連接聯接:

SELECT t2.word_id 
FROM table2 t2 
    , table1 t1 
WHERE t2.word_id = t1.word_id -- this is the join 
ORDER BY t1.word ASC