$rs25 = $connector->query("
SELECT * FROM
(SELECT content.*,topics.title AS topi2 FROM content
INNER JOIN topics
ON topics.id=content.topic) a
WHERE a.user='$sf' ORDER BY a.date DESC");
我认为问题在于这种语法。我想做的是SELECT topics.title
WHERE content.topic=topics.id
并按content.date (DATETIME)
DESC排序
或者也许我没有使用正确的加入?谢谢。
答案 0 :(得分:0)
您的问题中的子查询实际上不需要执行以下操作:
SELECT content.*,topics.title AS topi2
FROM content INNER JOIN topics
ON topics.id = content.topic
WHERE content.user='$sf'
ORDER BY content.date DESC