目标 当传入参数 @OrderId为空时 不做过滤 sql语句如下 SELECT o.* FROM `order` AS o LEFT JOIN receivemoneyconfirm AS re ON o.OrderID=re.FK_Order WHERE re.FK_Order=IFNULL(@OrderId,re.FK_Order) 起先一直以为 当 @OrderId为空时 对receivemoneyconfirm 表是不做过滤的 也就是 SELECT o.* FROM `order` A…
干oracle 047文章12当问题,经验group by 声明.因此邂逅group by rollup,decode,grouping,nvl,nvl2,nullif,RATIO_TO_REPORT等一下. 1. decode 与if...then,case...when...这类流数据语句功能差点儿相同 decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值) 该函数的含义例如以下: IF 条件=值1 THEN RETURN(值1) ELSIF 条件=值2 TH…
NVL: Converts a null value to an actual valueNVL2:If expr1 is not null, NVL2 returns expr2. If expr1 is null, NVL2 returns expr3. The argument expr1 can have any data type.NULLIF:Compares two expressions and returns null if they are equal; returns th…