如何在收件箱中对发件人的姓名进行排序?

时间:2017-11-06 21:13:20

标签: message whatsapp inbox columnsorting

我想按发件人的名字对收件箱进行排序。

我有以下用于排序的MySQL查询:

class Parent(object):

    def func(self):
        raise NotImplementedError


class Child(Parent):

    def __init__(self, user_input):
        if user_input == "func1":
            self.func = self._func1
        elif user_input == "func2":
            self.func = self._func2
        else:
            pass
            # make sure to guard against other possible inputs!

    def _func1(self):
        print("from func1!")

    def _func2(self):
        print("from func12")

但是,如果我发送任何消息,它不会排序。 我只是在收到消息时进行排序。

MySQL表格SELECT * FROM ( SELECT * FROM Msg_Tab ORDER BY uid DESC ) AS searchmsg GROUP BY sender;

Msg_Tabsenderreceivertime

1 个答案:

答案 0 :(得分:0)

您必须按sender排序。

SELECT * 
FROM (
  SELECT * 
  FROM Msg_Tab 
  ORDER BY uid DESC
) AS searchmsg 
GROUP BY sender
ORDER BY sender;