首页 > 解决方案 > R -- RJDBC 无法重命名 SQL 选择中的列

问题描述

使用 RJDBC 库似乎无法重命名 SQL 选择中的列。有人知道它的解决方法吗?我发现这个 useJDBC4ColumnNameAndLabelSemantics=true 用于 Db2,但不确定它是否可以在 R 中使用。

Select
a.customer,
b.customer as main_customer,  <-- returns as customer not main_customer
b.customer_email
from customer a,
     main_customer b
where a.customer_id = b.customer_id

标签: rdb2renamerjdbc

解决方案


找到这个 ->使用 Oracle SQL 开发人员查询 IBM DB2 的列别名

例如,在我的情况下,数据库名称是 SAMPLE,如果我希望应用程序显示我的查询中的相关 ID 名称,那么我使用数据库名称:

SAMPLE:useJDBC4ColumnNameAndLabelSemantics=No;

推荐阅读