在pgsql 子查询排序问题 返回

SqlSugar 沟通中
3 182
该叫什么 上瘾 发布于2周前
悬赏:0 飞吻

 var resultQueryNewData = resultQuery.Select((x) => new t_sntestvalue_status

 {

     createdate = x.createdate,

     sn = x.sn,

     station = x.station,

     testresult = x.testresult,

     testvalue = x.testvalue,

     islastflag = x.islastflag,

     mahineno = x.mahineno,

     projectno = x.projectno,

     numberOfTimes = x.numberOfTimes,

     processtag = x.processtag,


     #region 增加子查询..

     sntree = SqlFunc.Subqueryable<t_snTree>()

        .Where(t => t.sn == x.sn)

        .OrderBy(t=>t.createdate)

        .SelectStringJoin(t => t.sntree, ",")

     #endregion

 });

在子查询中增加排序 查询报错 column "t.createdate" must appear in the GROUP BY clause or be used in an aggregate function  我写原生sql查询 改成

(SELECT string_agg(("sntree")::text, ',' ORDER BY "t"."createdate")

就可以了 但是sqlsugar 中SelectStringJoin 并没有image.png此场景重载,sqlsugar版本是 5.1.4.93 数据库是pgsql

热忱回答3

  • 升级最新看看

    0 回复
  • 更新了 5.1.4.207 还是不行 image.png

    0 回复
  • 针对于pgsql 子查询排序的场景 现有框架是否有解决方案 没有的话 我就写原生sql了

    0 回复