Downloading result CSV with table prefix in headers

Hello,

I tried to find an option to download the results csv with tables name prefix (as shown in the photo)

but when I download I get two columns named "name" and I can not distinguish between them.

Any clue how to include the table prefix?

Thank you.

0
Avatar
Permanently deleted user

Anyone?

0

You need to use an alias.  If you want to keep the "." character then you will need to use a double quote for the alias.

select 'john' as name, 'doe' as name from dual;
/*
+----+----+
|NAME|NAME|
+----+----+
|john|doe |
+----+----+
*/

select 'john' as "fr.name", 'doe' as "f.name" from dual;

/*
+-------+------+
|fr.name|f.name|
+-------+------+
|john |doe |
+-------+------+
*/

 

0
Avatar
Permanently deleted user

Is there another way without specifying an alias? When having too much columns its annoying.

my query is something like this:

 

select fr.name, f.name

from table1 fr left join table2 f

and I have much more tables and columns

0

Kind of but not really, you could write your own CSV extractor that loops through the column names looking for dupes but then I don't know what you would replace it with.

Here is a link to the extractor https://www.jetbrains.com/help/datagrip/data-extractors.html 

0
Avatar
Permanently deleted user

I see. Thank you

0

请先登录再写评论。