1、UPDATE 表1 a, 表2 b SET a.字段1 = b.字段1, a.字段2 = b.字段2 WHERE 條件1
例:
update income_invoice_profit_center a,income_invoice_collection o
set a.profit_center_id = o.profit_center_id,a.profit_center_name=o.profit_center_name
where a.invoice_code=o.invoice_code and a.invoice_num=o.invoice_num and
a.profit_center_id is null
2、if(exp,值1,值2)
SELECT
DISTINCT t1.id,
t1.main_id,
t1.name,
if(t2.id is null,0,1) finish -- '1處理,0未處理'
from tax_partner t1
left join tax_declaration_report_partner t2
on t1.id =t2.partner_id
and t2.main_id=#{mainId} and t2.`month`=#{authMonth}