使用内联后,unitid有重复记录,选取AutoReplyId的最大值。
select b.*,c.ArticlesData from (select UnitId,max(AutoReplyId) as AutoReplyId from WxGenerateQrScan a where UnitId in (1,2,3,4,5) and System=6 group by UnitId) b inner join WxAutoReplyMessage c on b.AutoReplyId = c.Id
网友评论