如何将 ORDER BY columnName IS NULL DESC, columnName DESC
添加到 Propel 查询中。我也有同样的问题as in this question但我似乎无法使用 Propel 方法找到合适的解决方案。由于该子句将嵌入到相当复杂的查询构建过程中,因此我不想只转向纯 SQL。
最佳答案
如果您使用 ModelCriteria 您可以尝试:
$query = YourEntityQuery::create('e')
->withColumn('e.sortColumn IS NULL', 'isSortColumnNull')
->orderBy('isSortColumnNull', 'desc')
->orderBy('e.sortColumn', 'desc');
关于php - Propel 1 中按 NULL 排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44942895/