1

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)

  • what error do u get ? – Tharif May 16 '18 at 08:49
  • "An SQL error occurred: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'table2 OR' at line 2" – Sakthivel M May 16 '18 at 08:53

1 Answers1

0

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

    $joinQuery  = ' from (SELECT * from `table1` ';
    $joinQuery .= ' UNION ALL';
    $joinQuery .= ' SELECT * from `table2` ) temp';
parthi
  • 424
  • 1
  • 4
  • 16