【发布时间】:2009-08-25 23:51:53
【问题描述】:
我有两张这样的表 ->
Categories
-----------
id name
---------
1 --> a
2 --> b
3 --> c
Messages
------------
id catid message
---------------------------
1 --> 1 --> aa
2 --> 1 --> bb
3 --> 1 --> cc
4 --> 2 --> dd
5 --> 3 --> ee
6 --> 3 --> ff
i want to join the tables for get FIRST message from messages table,
我想要这样的查询结果 ->
-------------------------------
id name message
1 a aa
2 b dd
3 c ee
我找到了一个代码
select * from categories c, items i
-> where i.categoryid = c.id
-> group by c.id;
但没有任何 ORDER BY 过程
【问题讨论】: