ORACLE数据库有两个字段RECEIVER_MOBILE与RECEIVER_PHONE,同为联系方式。当RECEIVER_MOBILE为空的时候,需要用到RECEIVER_PHONE,但是查询语句字段不能多于,于是有了下面的语句。 SELECT RECEIVER_MOBILE,RECEIVER_PHONE,CASE WHEN RECEIVER_MOBILE IS NULL THEN (SELECT TO_CHAR(RECEIVER_PHONE) FROM TB_EXT_TRADE WHERE TID LIKE '%DH1504103135-095%')
ELSE '' END AS mobile from TB_EXT_TRADE WHERE TID like '%DH1504103135-095%';
|