我想在ssp2简单类中使用下面的SQL查询

 select * from table1 UNION ALL select * from table2


我在下面的查询ssp::simple class中尝试过,但是它不起作用。

$table ='';

$joinQuery = ' from table1 UNION ALL table2';

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


注意:我正在使用Xampp 5.6.24(MariaDB)

最佳答案

从table1 UNION ALL table2替换您的joinQuery而不是$ joinQuery =';

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

关于mysql - 如何在ssp简单类中使用UNION ALL?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50366030/

10-09 20:20