KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

QueryBuilder - two joins of the same table. #1033

Open SOFMAN opened this topic on on Aug 7 - 1 comments

SOFMAN commented on Aug 7

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

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.

Give tips to supporter for his good work

If you feel that supporter has done a good work, consider giving him some credit. Any amount put into the tips box below is appreciated. By doing so, you have contribtuted to the existence of KoolReport and the quality of support.

Tips box
help needed

QueryBuilder