我想按发件人的名字对收件箱进行排序。
我有以下用于排序的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_Tab
,sender
,receiver
,time
。
答案 0 :(得分:0)
您必须按sender
排序。
SELECT *
FROM (
SELECT *
FROM Msg_Tab
ORDER BY uid DESC
) AS searchmsg
GROUP BY sender
ORDER BY sender;