KoolReport's Forum

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

More than one sql statements #110

Open zenon opened this topic on on Sep 13, 2017 - 8 comments

zenon commented on Sep 13, 2017

Hi KoolReport,

There are 2 SQL statements in one query. Will KoolReport able to read them and generate out the report?

Appreciate your help.

Thanks.

KoolReport commented on Sep 13, 2017

It should be one query with one statement to preserve the data consistency. Could you please explain more details of your use case?

zenon commented on Sep 13, 2017

For example,

USE database1;

SELECT * FROM table1 WHERE date='@Date';

Both the above sql statements is in the same column. How to ensure KoolReport able to run both the sql statements to generate out the report?

KoolReport commented on Sep 13, 2017

Normally in the datasource, you need to specify the database name. What I suggest you to do is to create different data source for different database so that you do not need to use the "USE database1" command. I have not try to use 2 SQL statement, but it guess it work. You can try.

zenon commented on Sep 13, 2017

I have tried, but to no avail. I am not sure whether KoolReport could not read it as 2 separate sql statements,or there are other mistakes.

By the way, in the datasource, how to specify more than one database name?

KoolReport commented on Sep 13, 2017
 "dataSources"=>array(
    "source1"=>array(
        "connectionString"=>"mysql:host=localhost;dbname=database1",
        "username"=>"root",
        "password"=>"",
        "charset"=>"utf8"
    ),
    "source2"=>array(
        "connectionString"=>"mysql:host=localhost;dbname=database2",
        "username"=>"root",
        "password"=>"",
        "charset"=>"utf8"
    )
)
zenon commented on Sep 13, 2017

I have tried the above, it works only when I delete the USE database1 command.

Is there any other alternatives if I insist to remain the USE database1 command?

KoolReport commented on Sep 13, 2017

Then no I am afraid. We will consider this as suggestion for future version.

zenon commented on Sep 13, 2017

okay sure.

Thank you very much.

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

None