复杂的Laravel查询

时间:2016-05-20 10:13:00

标签: php laravel laravel-5.1

我想将以下SQL查询转换为Laravel Eloquent或Query

SELECT County, SUM(Score) AS TotalScore
FROM (                   
  SELECT County1 AS County, Player1_Score AS Score
  FROM mytable

  UNION ALL

  SELECT County2, Player2_Score
  FROM mytable) AS t
GROUP BY County
ORDER BY TotalScore DESC

我想转换成Laravel任何想法吗?

1 个答案:

答案 0 :(得分:2)

尝试这样的事情:

function afterDraw() {
    var g = document.getElementsByTagName("svg")[0].getElementsByTagName("g")[1];
    document.getElementsByTagName("svg")[0].parentNode.style.top = '40px';
    document.getElementsByTagName("svg")[0].style.overflow = 'visible';
    var height = Number(g.getElementsByTagName("text")[0].getAttribute('y')) + 15;
    g.setAttribute('transform','translate(0,-'+height+')');
    g = null;
}