-1

我有两个表节点和 sort_value。在节点我有这个

+----------------+----------------+----------+----------------+
|     nid        |     content    |   state  |      etc       |
+----------------+----------------+----------+----------------+
|      1         |     Nanuet     |    NY    |  some content  |
+----------------+----------------+----------+----------------+
|      2         |     Nanuet     |    NY    |  some content  |
+----------------+----------------+----------+----------------+

在 sort_value 表中我有

+----------------+----------------+----------+
|  sort_order    |      city      |   state  |
+----------------+----------------+----------+
|       1        |     xxxxxx     |    NY    |
+----------------+----------------+----------+
|       2        |     xxxxxx     |    NY    |
+----------------+----------------+----------+

我只想从节点表中选择 nid 并根据 sort_value 表中的 sort_order 值对选定的 nid 进行排序。

我怎样才能做到这一点??

谢谢

4

2 回答 2

0
SELECT N.nid,S.sort_order,S.city,S.state from node N INNERJOIN sort_value S WHERE N.nid=S.sort_order;
于 2013-01-04T06:28:17.660 回答
0

希望这是加入条件::试试这个::

SELECT 
*
from 
node  
INNER JOIN sort_value  ON nid=sort_order
于 2013-01-04T06:32:03.717 回答