Took me some time to figure out how to get my SQL Query on Laravel 4 Query Builder.
SQL requirement : Left join two tables, having one of the query with aggregation.
Raw SQL :
SELECT A.repid,A.fname,A.lname,B.reg_tot FROM sales_rep A
(SELECT repid,sum(reg_count) as reg_tot FROM `sales_rep_board`
group by repid) B
on A.repid = B.repid
LARAVEL 4 Query Builder :