假设我有一个这样的数据库设计:
对于数据:
id |    title     | category
1  | first title  | 1
2  | second title | 4
3  | third title  | 5
4  | fourth title | 2
5  | fifth title  | 3
6  | other title  | 1
对于类别:
id | name 
1  | music 
2  | movies
3  | funny 
4  | people 
5  | sport 
如何输出每个类别的列表以及该类别中的项目标题?
有人认为:
<div>
<h1>music</h1>
<div>first title</div>
<div>other title</div>
<div>
<div>
<h1>movies</h1>
<div>fourth title</div>
<div>
// and so on...
我不知道如何为这样的结果制定 mysql 查询......
有人可以给我建议吗?(我希望这个例子可以很容易理解)
提前致谢。
编辑:我使用了 Eugen Rieck 的代码,但我不知道如何做以下事情
我怎样才能在同一时间订购categories.id并titles.id最终在此之后使用 where 条件?
像这样的东西:  ORDER BY titles.id DESC LIMIT 0, 10 WHERE titles.views > 10