mysql - 如何在子查询中使用计算字段(sqlite3)
问题描述
我有这个在MySQL中工作的代码
CASE
WHEN e.sex = 'M' THEN ROUND((salary / 30 * absents) + (salary / 30 / 8 * short_hours * 1.5))
ELSE ROUND((salary / 30 * absents) + (salary / 30 / 5 * short_hours * 1.5))
END AS deductions,
CASE
WHEN e.sex = 'M' THEN ROUND(salary / 30 / 8 * overtime * 1.5)
ELSE ROUND(salary / 30 / 5 * overtime * 1.5)
END AS overtime_bonus,
ROUND(salary - (SELECT deductions) + (SELECT overtime_bonus)) AS total_salary,
我试图让它在SQLite中工作,但我得到了错误no such column: deductions
我的问题是:我可以在 SQLite3 的子查询中使用计算字段吗?
解决方案
推荐阅读
- c++ - 具有不同类类型的链表
- c++ - 使用 std::vector 或 std::set 进行排序且没有重复元素?
- docker - 如何从 Docker 容器制作镜像
- java - 为 Stripe Api 创建客户
- r - 仅绘制特定轴文本标签
- flutter - 如何在颤动中使画布的角落变圆
- jestjs - 如何在 handleTestEvent 函数或 afterEach 块中访问 Jest 测试状态(失败或通过)?
- python - vmcloak 安装后失败,语法无效
- swift - 如何在 SwiftUI 中使用 VideoPlayer() 全屏显示?
- javascript - Odoo 13 Enterprise SaaS,我可以编辑产品搜索模块以仅使用 JavaScript 搜索产品描述吗?