我在名为message的表中有这些值:
id message_id message
1 1 Hello sir
2 1 Hi dear.
3 2 Send by admin.
4 2 send by helper.
5 3 created by me.
6 3 Done by user.
我的结果是下面的表格。
id message_id message
1 1 Hello sir
3 2 Send by admin.
5 3 created by me.
请帮助。
答案 0 :(得分:1)
你可以尝试,只需使用一个选择唯一值的distinct子句。
SELECT DISTINCT * from meassage;
答案 1 :(得分:0)
select M.id, M.message_id, M.message
from message M
WHERE M.ID = (SELECT MIN(M1.ID) FROM MESSAGE M1 WHERE M1.MESSAGE_ID = M.MESSAGE_ID) ;