我有以下表SQL连接问题
nid timestamp title
82 1245157883 Home
61 1245100302 Minutes
132 1245097268 Sample Form
95 1245096985 Goals & Objectives
99 1245096952 Members
和
pid src dst language
70 node/82 department/34-section-2
45 node/61/feed department/22-section-2/feed
26 node/15 department/department1/15-department1
303 node/101 department/101-section-4
这些表的片段,以及缺少数据的其余部分(它们都是相当大),但我正在尝试将第二个表中的第d列加入第一个表中。他们应该匹配他们的“nid”,但第二个表有node/[nid],这使得这更加复杂。我也想忽略那些以“饲料”结尾的饲料,因为它们不是我所需要的。
很大程度上得益于
编辑:我觉得不好没有提及这一点,但第一个表是从
select nid, MAX(timestamp) as timestamp, title from node_revisions group by nid ORDER BY timestamp DESC LIMIT 0,5
第二个表的名称为“url_alias”
BTW发布关于SQL的问题时,你应该张贴您正在使用的DBMS因为它可以产生巨大的差异 – 2009-06-16 13:41:29