我的 SQL 语句看起来像这样
SELECT SQL_CALC_FOUND_ROWS q.id, q.question, sb.subject, c.chapter, sc.section, p.paragraph
FROM questions AS q
, subjects AS sb
, sections AS sc
, chapters AS c
, paragraphs AS p
WHERE (sb.id=q.subject AND c.id=q.chapter AND sc.id=q.section AND p.id=q.paragraph) AND (q.author_id=1)
ORDER BY q.id asc
LIMIT 0, 25
如您所见,这些表通过 id 相互关联。问题是,我得到subject
的是表格列questions
而不是表格subject
列subjects
。我在这里想念什么?
笔记
我提供了主题作为示例。实际上所有三个部分 AS sc、章节 AS c、段落 AS p 都不起作用。我得到的只是主题。