简体   繁体   中英

R — RJDBC not able to rename column in SQL select

Using the RJDBC library seems like you can't rename the column in the SQL select. Anyone know a workaround for it? I found this useJDBC4ColumnNameAndLabelSemantics=true for Db2, but not sure it can use it in 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

Found this -> Column alias querying IBM DB2 using Oracle SQL developer

For example, in my case the database name is SAMPLE and if I want the application to show the correlation-ID names from my queries then I use for the database-name:

SAMPLE:useJDBC4ColumnNameAndLabelSemantics=No;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM