thinkphp5 Union 联合联合查询 联合查询多张表 成一组数据
$sql1 = Db::name('user')->field('id,username')->where('id <=10')->buildSql();
$sql2 = Db::name('user')->field('id,username')->where('id >20 and id<=30')->buildSql();
$sql3 = Db::name('user')->field('id,username')->where('id >40 and id<=50')->union([$sql1,$sql2])->buildSql();
$list = Db::name(strtolower($sql3) . ' a')->order('a.id asc')->paginate(每页几条, false, ['page' => 第几页]);