如果当月该客户已填报,取A表当月该客户填报型号; 如果当月该客户未填报,上月已填报,取A表上月客户填报型号; 如果上月也未填报,则取B表的所有型号;SQL怎么写? SELECT distinct xh FROM ${if(LEN(XH)>0," fr_psi_zb_qd_tb","fr_psi_xhzb_tb")} where 1=1 ${if(LEN(XH)>0," and month='"+LEFT(jhyd,7)+"' and org_code='"+org_name+"'","and org_code='"+org_name+"' and customer='"+$customer+"'")} |
最佳回答 |
||||
0
|
|