2009-04-28 47 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