UNION ALL
1.使用场景:用于无关联的两张表实现分页查询;分表后实现分页查询
2.使用语法:select 字段集合1 from table1 查询条件 union all select 字段集合2 from table2 查询条件
3.注意事项:字段集合1和字段集合2的数量必须一致
4.示例:
$query = InvoiceRecord::find();
$query->alias('f');
$query>select("fp_id,f.create_time,fap_tai,number,before_price,c_fpqqlsh,c_bhsje,c_hjse,reject_content,gazeto_rimarko,fp_type,c_jpg_url,c_url,c_buyername,c_fpdm,c_fphm,c_invoiceid,c_jym,c_msg,c_resultmsg,c_orderno,c_taxnum,FROM_UNIXTIME(c_kprq, '%Y-%m-%d %H:%i:%s') AS `date`,o.order_code,o.status",'IFNULL(f.c_bhsje,"") as c_bhsje,')