簡體   English   中英

GROUP BY 中的 Doctrine Query Builder CONCAT

[英]Doctrine Query Builder CONCAT in GROUP BY

我想在學說 2 的 ORDERBY 函數中添加 CONCAT。

嘗試在學說文檔中搜索並在網絡中瀏覽,但無法找到解決方案

以下語法引發錯誤

 $qb = $this->createQueryBuilder("t");
 $qb->addOrderBy('CONCAT(tep.echtgenootNaam,tep.eigennaam)', $direction);
$qb->addSelect("CONCAT(col1, col2...) AS HIDDEN cat")
  ->orderBy("cat")

為此,您需要安裝 DoctrineExtensions。

我認為您不能在 addOrder 表達式中使用 CONCAT。 但是您可以執行類似的操作:

 $qb->addOrderBy('tep.echtgenootNaam', $direction);
 $qb->addOrderBy('tep.eigennaam', $direction);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM