将mysql查询转换为laravel语法

时间:2018-04-04 01:04:46

标签: mysql laravel

我不知道如何将子查询转换为laravel查询。 我如何将mysql查询转换为laravel查询? 这是查询

select vd_id, subCount
from   (select vd_id, count(vd_id) subCount 
        from sell_data
        group by vd_id) sub
        where subCount = (select count(vd_id) maxCount
                          from sell_data
                          group by vd_id 
                          order by maxCount desc limit 1) 
           or subCount = (select count(vd_id) minCount
                          from sell_data
                          group by vd_id 
                          order by minCount asc limit 1) ;

1 个答案:

答案 0 :(得分:2)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<button class="btn-blue">blue</button>
<button class="btn-red">red</button>
<span class="percentages">blue: 0%, red: 0%</span>

<div id="chartContainer" style="height: 160px; width: 100%;">
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>