我有一个查询和类似的结果
select "URL Listed" as _url, count(url) as total from listings where url != "0" group by 1 union all select "URL Not Listed" as _url, count(url) as total from listings where url = "0" group by 1
,结果是这样enter image description here 。现在我想将其转换为laravel。可能需要一些建议。非常感谢
答案 0 :(得分:0)
尝试此代码
$urls_details = DB::select("select 'URL Listed' as _url, count(url) as total from listings where url != '0' group by 1 union all select 'URL Not Listed' as _url, count(url) as total from listings where url = '0' group by 1");