union all
用sql查询出ID相同两次结果 用 union all 链接。
避开union all 中使用order by
select a.dates,b.goodsid,a.summaries from goodacctMt a join goodacctDt b on a.acctpageid = b.acctpageid and a.entid = b.entid where 1=1 and a.ruleid in ('2ajc0ikub06h2dbl') and a.acctpageid in (select top 1 c.acctpageid from goodacctMt c join goodacctDt d on c.acctpageid = d.acctpageid and c.entid = d.entid where c.ruleid in ('2ajc0ikub06h2dbl') order by c.dates desc) union all select a.dates,b.goodsid,a.summaries from goodacctMt a join goodacctDt b on a.acctpageid = b.acctpageid and a.entid = b.entid where 1=1 and a.ruleid in ('12ealvx84t7bl04x') and a.acctpageid in (select top 1 c.acctpageid from goodacctMt c join goodacctDt d on c.acctpageid = d.acctpageid and c.entid = d.entid where c.ruleid in ('12ealvx84t7bl04x') order by c.dates desc)