gpt4 book ai didi

sql - Symfony2 Doctrine 查询构建器中的 IFNULL

转载 作者:行者123 更新时间:2023-12-04 05:59:27 32 4
gpt4 key购买 nike

IFNULL怎么样了在 Symfony2 Doctrine Query Builder 中实现的 SQL?
假设我有这个查询:
select * from ticket order by IFNULL(modified_date, '2000-01-01') DESC, created_date DESC
我有这个 DQL:

$this->qb->select("t, c.name")
->from("Ticket", "t");
$this->qb->orderBy("t.modifiedDate", "DESC");
$this->qb->addOrderBy("t.createdDate", "DESC");

现在如何添加 IFNULL 部分?

最佳答案

好吧,做了一些研究,发现没有这样的实现。

谷歌搜索了一些,发现这种缺失的功能可以作为自己的功能添加到 Doctrine 中。

找到 this extension on GitHub我认为这会奏效。但是想知道是否会与 Doctrine 版本有任何问题或冲突......

关于sql - Symfony2 Doctrine 查询构建器中的 IFNULL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9099412/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com