当前位置:网站首页>oracle的sql改成mysql版本
oracle的sql改成mysql版本
2022-08-02 08:01:00 【CSDN问答】
oracle语句改写成mysql
select nvl(sum(is_this_month),0) as total, nvl((sum(is_this_month) - sum(is_last_month)),0) as month_count, nvl((sum(is_today) - sum(is_last_day)),0) as day_count from (select case when to_char(TRUNC(SYSDATE - 1), 'dd') = to_char(VALID_DATE, 'dd') then 1 else 0 end as is_last_day, case when to_char(sysdate, 'dd') = to_char(VALID_DATE, 'dd') then 1 else 0 end as is_today, case when to_char(sysdate, 'MM') = to_char(VALID_DATE, 'MM') then 1 else 0 end as is_this_month, case when to_char(TRUNC(add_months(trunc(sysdate), -1), 'MM'), 'MM') = to_char(VALID_DATE, 'MM') then 1 else 0 end as is_last_month from (SELECT * FROM API_SERVICE WHERE VALID_DATE is not null and VALID_DATE > TRUNC(ADD_MONTHS(sysdate, -1), 'mm'))) b如何改写成mysql版本
边栏推荐
猜你喜欢
随机推荐
暂未找到具体原因但解决了的bug
sql创建表格 如图 运行完提示invalid table name 是什么原因
如何做好项目管理
HCIP第一天
@Repository详解
Flink 系统性学习笔记系列
HCIP 第四天
MySQL之创建表的基本操作
王学岗-编译出运行的文件
High imitation [Huawei consumer business official website] and wonderful animation analysis: practice embedding JS code in low-code platform
@FeignClient configuration参数配置
学习笔记(8)DOM
[OC学习笔记]ARC与引用计数
[ansible]playbook结合项目解释执行步骤
设置工作模式与环境(中):建造二级引导器
Ansible 学习总结(11)—— task 并行执行之 forks 与 serial 参数详解
Application and case analysis of CASA model and CENTURY model
Visual Analysis of DeadLock
小说里的编程 【连载之二十四】元宇宙里月亮弯弯
The crawler video crawl tools you get









