KoolReport's Forum

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

QueryBuilder - two joins of the same table. #1033

Closed 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.

KoolReport Is Free and Open-Source!

KoolReport is a professional php reporting framework which saves you tons of time to construct dynamic data report & dashboard.

  • Connect to various datasources such as MySQL, SQL Server, MongoDB or even from CSV or Excel file.
  • Contain series of powerful built-in data processes for your data manipulation.
  • Generate stunning charts and graphs to help you communicate data insights to your audiences effectively.
  • Integrate seamlessly with any php frameworks such as Laravel, CodeIgniter, Symfony.
Download Now and register our tutorials to get started!

Download KoolReport
help needed

QueryBuilder