Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

How to alias selected column #649

Closed
seraphjiang opened this issue Jul 31, 2020 · 3 comments
Closed

How to alias selected column #649

seraphjiang opened this issue Jul 31, 2020 · 3 comments
Labels
wontfix This will not be worked on Workbench

Comments

@seraphjiang
Copy link
Member

I have a sql like below and try to run in 7.4

SELECT t1.Id as ID 
FROM table1 t1
  LEFT JOIN table2 t2
ON
  t1.id = t2.id

below is what i got with sql
Actual result

t1.Id
---
1
2
3

this is what expected.

Expected result

ID
--
1
2
3

Does SQL support alias selected column?

@dai-chen
Copy link
Member

Just tried a similar query in DevTools. The response in default format looks right. This may be an issue in SQL Workbench. @chloe-zh Do we support column alias in SQL Workbench. I didn't find open issue related.

POST _opendistro/_sql
{  
  "query": """
      select a1.city AS c from accounts a1 LEFT JOIN accounts a2 ON a1.age = a2.age
      """
}
{
  "schema": [{
    "name": "a1.city",
    "alias": "c",
    "type": "text"
  }],
  "total": 200,
  "datarows": [
    ["Rote"],
    ["Beyerville"],
    ["Mahtowa"],
    ["Nanafalia"],

@chloe-zh
Copy link
Member

chloe-zh commented Jul 31, 2020

@dai-chen Yes we support alias in workbench now.
Hi @seraphjiang , what version of workbench are you using? Please checkout v1.9.0.0 or later since the issue (amazon-archives/sql-workbench#45) was fixed right before v1.9 was released.

@seraphjiang
Copy link
Member Author

seraphjiang commented Aug 4, 2020

Thanks @dai-chen @chloe-zh

we are using 1.4.0.0, elasticsearch 7.4.2, we plan to upgrade to 7.7 soon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on Workbench
Projects
None yet
Development

No branches or pull requests

3 participants