cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use User Session Query Alias

Axel
Guide

Hi community,


i want to write this User Session Query:

SELECT useraction.name, COUNT(errorCount) from useraction WHERE name="name-of-useraction" GROUP BY useraction.name. It's work, but i must change the useraction's name (only in this query, i can't change the real name). I tried some like this query, withuot success:

SELECT useraction.name, COUNT(errorCount) from useraction WHERE name="name-of-useraction" AS "name-changed" GROUP BY useraction.name

The AS command doesn't work in this case, so how can i change my useraction's name in this query?


Thanks

7 REPLIES 7

JamesKitson
Dynatrace Leader
Dynatrace Leader

The alias goes in the select part not the where clause:

select name as "New Name", count(errorCount) from useraction where name="name-of-useraction" group by name

Hi James, i can use this query: SELECT useraction.name AS "new name", COUNT(errorCount) from useraction WHERE name="old name" GROUP BY useraction.name and it's work, but doesn't change the useraction's name.

There is another way?

JamesKitson
Dynatrace Leader
Dynatrace Leader

Oh I see the misunderstanding, you're not changing the name itself by doing an alias. You're changing the column name (i.e. what shows up in the column header in a table). I don't believe you can just rename the action like that outside of the funnel function.

Depending on what you're trying to do I'd just leave off the action name and use either an alias on the error count field or just the usql query name to specify what you'd like to refer to the action as:

I'm trying to execute this query in Bar Chart visualization (because i need to it):


When i upload query into the tile, i can't see full name, but only "Loading of page..." because it's cropped. So, i must use the alias command to write a shorter name.

Thanks for your help

ChadTurner
Leader

Changing the Name of Columns is not supported at this time. I Spent some time looking for any way that we could adjust the name, even support looked into it and concluded that it was not possible at this time.

-Chad

Thank you Chad for your answer

You're very welcome

-Chad