沈静伟 3 лет назад
Родитель
Сommit
5193598239

+ 8 - 1
src/dsb/com/cnd3b/restcontroller/system/im/imdialog/SQL/即时通讯普通群列表查询.sql

@@ -3,4 +3,11 @@ t2.createdate as fjoindate,t2.fname,t2.funreadmsgcount,t1.tenterprise_userid as
 inner join timdialogusers t2 on t1.siteid=t2.siteid and t1.timdialogid=t2.timdialogid
 where t1.siteid=$siteid$ and t1.fimdialogtype='ÆÕͨ' and t2.tenterprise_userid=$tenterprise_userid$ and t2.fisremove=0
 and $where$
-order by (select MAX(timdialogmessageid)timdialogmessageid from timdialogmessage where siteid=$siteid$ and timdialogid=t1.timdialogid group by timdialogid)desc
+order by (
+    select MAX(createdate) from (
+        select createdate from timdialogmessage
+        where siteid=t1.siteid and timdialogid=t1.timdialogid
+        union all
+        select createdate from timdialog where siteid=t1.siteid and timdialogid=t1.timdialogid
+    )t
+)desc