select ta.mdmc,ta.rq,ta.spid,ta.spmc,,ta.xszje,tb.xsje,if(ta.xszje>tb.xsje,ta.xszje,tb.xsje) xsze from (select mdmc,rq,spid,spmc,xszje, from sale_daily where rq>='2022-11-23')ta join (select rq,mdmc,spid,xsje from sale_sprl where rq>='2022-11-23') tb on ta.rq=tb.rq and ta.mdmc=tb.mdmc and ta.spid=tb.spid 我要取ta.xszje,tb.xsje后面加一列xsze,有个判断,如果ta.xszje比tb.xsje大,就取ta.xszje,小就取tb.xsje,我语句这样加个IF报错为什么?请指教应该怎么写? |