我的查詢構建器看起來像這樣
$qb
->select([
'c.id as c_id',
'c.name as c_name',
sprintf('(SELECT COUNT(t) FROM %s t WHERE t.example = c.example) as t_total',
t::class),
sprintf('(SELECT COUNT(z) FROM %s z WHERE z.example = c.secondExample) as z_total',
z::class),
])
->from(c:class, 'c')
->getQuery()->getResult();
有沒有辦法檢查 t_total 和 z_total 是否為空?我不想僅在 t_total AND z_total 為空/空時才顯示此行
uj5u.com熱心網友回復:
正如@mickmackusa 所說
$qb->having('z_total IS NOT NULL OR t_total IN NOT NULL');
以我想要的方式作業
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/379367.html
下一篇:控制器不存在
