KoolReport's Forum

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

SQL message: ambiguous column while using searchbox #3382

Open Marloes opened this topic on on Nov 19 - 5 comments

Marloes commented on Nov 19

Hi there,

Regarding the Dashboard -> datatable/grid. If I have a query including a join like:

$query->leftJoin("masterman", "settings.method_id","=","masterman.method_id")
                ->select("settings.id")
                ->select("masterman.description")
                ->select("settings.description")->alias("description_setting")

... and performing a search in the searchbox, then it qives me a SQL message (SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'description' in where clause is ambiguous). How is this possible while I am using an "alias" ?

With kind regards, Marloes

Sebastian Morales commented on Nov 20

What is your "description" field definition? How about setting aliases for both tables' "description" fields?

Marloes commented on Nov 20

Text::create("description")->label("Whatever"). I've also tried naming both aliases. But is doesn't make any sense because while searching it probably is searching both columnnames in the same query despite it's alias.

Marloes commented on Nov 20

And if I do this:

->select("settings.description")->alias("description_setting")
Text::create("description_setting")
                ->label("Ladidaaaa")
                ->searchable(true)
                ->sortable(true),

It shows me the right description in the table, but while searching on it it says "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'description_setting' in 'where clause'"

Sebastian Morales commented on Nov 21

We will find a solution for your case and let you know the result soon.

Sebastian Morales commented on Nov 22

Pls send us an email to support@koolreport.com and mention this topic. We will send you an development version of Dashboard to solve this issue.

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
bug

Dashboard