KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

QueryBuilder - two joins of the same table. #1033

Closed SOFMAN opened this topic on on Aug 7, 2019 - 1 comments

SOFMAN commented on Aug 7, 2019

I need to do two joins with the same table, I have tried to assign an alias to each table as shown in the code but it is not possible I get an error. How can I add an alias to each table?

$this->src("mysql")->query(MySQL::type( DB::table('cuenta_cobrar')
            ->join('vendedor as v1', 'cuenta_cobrar.vendedor', '=', 'v1.id')
            ->join('vendedor as v2', 'cuenta_cobrar.recaudador', '=', 'v2.id'))
            ->select('v1.nombre')->alias('VENDEDOR')
            ->select('v2.nombre')->alias('RECAUDADOR'))
            ->pipe($this->dataStore("datos"));
KoolReport commented on Aug 10, 2019

Could you please locate the koolreport/querybuilder/MySQL.php file and put following content:

<?php

namespace koolreport\querybuilder;

class MySQL extends SQL
{
    protected $indentifierCover=array("","");
}

Try again and let me know if it works.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

QueryBuilder