摘要: full join 空值填充 SELECT coalesce( NULL , 0) as tianchong FROM DUAL SELECT coalesce( '' , '0') as tianchong FROM DUAL SELECT A.M, coalesce(B.N, 'X') AS N 阅读全文
posted @ 2020-12-02 18:43 码农阿亮 阅读(735) 评论(0) 推荐(0) 编辑
摘要: full join ,left join ,right join,inner join 一、full join full join SELECT A.*, B.* FROM (SELECT 0 AS T1 FROM DUAL UNION SELECT 1 AS T1 FROM DUAL UNION 阅读全文
posted @ 2020-12-02 18:41 码农阿亮 阅读(262) 评论(0) 推荐(0) 编辑
摘要: SQL语句实现按照分组划分优先级 分组划分优先级 SELECT B.* FROM (SELECT A.color, A.P, row_number() over(partition by P order by color desc) rn FROM (SELECT 'red' AS color, ' 阅读全文
posted @ 2020-12-02 18:38 码农阿亮 阅读(875) 评论(0) 推荐(0) 编辑
摘要: SQL SERVER 中相关的时间 1、获取当前时间 select getdate() 2、截取需要的值 select datepart(year,getdate()) select datepart(month,getdate()) select datepart(day,getdate()) s 阅读全文
posted @ 2020-12-02 18:35 码农阿亮 阅读(251) 评论(0) 推荐(0) 编辑