Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SQLite排序问题_Sqlite - Fatal编程技术网

SQLite排序问题

SQLite排序问题,sqlite,Sqlite,我使用以下查询按字母顺序显示数据库行: SELECT word_id FROM table1 ORDER BY word ASC 但我想从表2中得到值,在表2中没有“word”列,并按表1中的“word”列对其进行排序 我想要这样的东西: SELECT word_id FROM table2 ORDER BY table1.word ASC 提前感谢。您必须使用联接连接两个表: SELECT t2.word_id FROM table2 t2 , table1 t1 WHERE t2.

我使用以下查询按字母顺序显示数据库行:

SELECT word_id FROM table1 ORDER BY word ASC
但我想从表2中得到值,在表2中没有“word”列,并按表1中的“word”列对其进行排序

我想要这样的东西:

SELECT word_id FROM table2 ORDER BY table1.word ASC

提前感谢。

您必须使用联接连接两个表:

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

必须使用联接连接两个表:

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
有一种叫做“加入”。。。喜欢阅读:)有一种叫做“加入”的东西。。。喜欢阅读它:)