How to use UNION ALL in ssp simple class?

394 views Asked by At

I want to use below SQL query in the ssp2 simple class

 select * from table1 UNION ALL select * from table2

I tried below query ssp::simple class but it does not work.

$table ='';

$joinQuery = ' from table1 UNION ALL table2';

return Ssp::simple($_POST, $this->sql_details, $table, $primaryKey, $columns, 
       $joinQuery, $filterQuery, null, null, null);

Note: I am using Xampp 5.6.24 (MariaDB)

1

There are 1 answers

0
parthi On BEST ANSWER

Replace your joinQuery instead of $joinQuery = ' from table1 UNION ALL table2';

    $joinQuery  = ' from (SELECT * from `table1` ';
    $joinQuery .= ' UNION ALL';
    $joinQuery .= ' SELECT * from `table2` ) temp';