html - 合并 Apex 报告中的两列
问题描述
我的报告中有两列:金额和货币,而不是在单独的列中显示每一列我想在一列中显示货币旁边的金额我知道我可以在 SQL 中使用:
select amount||currency_id from my_table
或(因为货币列是共享组件)
select amount||currency from my_table, currency_table
where my_table.currency_id = currency_table.currency_id
那么有没有办法合并它们或SQL代码是唯一的方法?
解决方案
编写SQL的正确方法是:
select t.amount || c.currency
from my_table t join
currency_table c
on t.currency_id = c.currency_id;
笔记:
- 切勿在
FROM
子句中使用逗号。 - 始终使用正确、明确、标准、可读的
JOIN
语法。 - 限定查询中的列引用,以便您知道列的来源。
- 使用表别名,因此查询更易于编写和阅读。
推荐阅读
- ios - ios ble中央后台找不到ios ble周边背景
- java - Zeppelin JDBC 解释器在 0.9.0-preview1 版本中出现错误
- flutter - GetStream.io 的帖子就像在 facebook 中一样
- c# - 无法显示来自 responsebody HttpClient 获取请求的数据
- ios - 合并匿名帐户时客户端登录错误的 Firebase 身份验证行为
- mysql - 通配符 SQL 连接相似的表并打印组合结果
- node.js - Elasticsearch 响应空白_source
- reactjs - 重新渲染时意外调用 useSelector 选择器函数
- ios - 使用 iOS NumberFormatter 将小数格式化为分数表示
- ios - 如何在 Flutter 中进行小于或等于的布局?