Laravel:查询生成器返回额外的行

时间:2017-09-28 05:46:32

标签: php mysql laravel query-builder

我正在尝试使用服务,客户和工作生成报告。交易

$status_report = \DB::table('services')
                 ->join('customers','services.id','customers.service_id')
                 ->join('transactions','customers.id','transactions.customer_id')    
                 ->select('customers.customer_name','customers.uniqueId','customers.id',
                          'customers.mobile_number', \DB::raw('transactions.id as t_id'),'customers.box_number' ,'customers.voucher_number' ,'services.name','customers.status','transactions.net_amount','transactions.paid_amount','customers.receive_date','customers.receive_time','customers.referrar','transactions.due')
                 ->groupBy('customers.customer_name','customers.voucher_number','services.name','customers.status','customers.uniqueId','customers.id','transactions.paid_amount','transactions.due','customers.box_number')
                 ->orderBy('customers.status')    
                 ->get();

上述查询将返回每个事务的单行数据。但问题是,当我customers.status == 1时,它返回相同的行double。我怎样才能获得每笔交易的独特交易行?

0 个答案:

没有答案