1 union 和union all的区别?
union all比union合并的效率快的多.union all 只是将查询出来的结果集合并到一块,并没有字段的排序和去重复数据.
而union会去重复数据和对查询出来的结果进行排序;
2 sql中做计算 和小数做加减乘除运算,要转换成float或者double类型.
-- *12.5
* CONVERT(DECIMAL(18, 1), CAST(a.AllowanceDay AS FLOAT)-10) * 0.7
--* CONVERT(DECIMAL(18, 1),CAST(CAST(a.AllowanceDay AS INT ) - 10 AS INT )) * 0.7
3 SQL去除回车符,换行符,空格和水平制表符
REPLACE(REPLACE(REPLACE(REPLACE([fieldName],CHAR(13),''),CHAR(10),''),CHAR(9),''),' ','')