Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Inconsistency in query outcome

Tejas_Thakkar3
New Contributor
New Contributor

Hello, everyone.

We have a requirement to sort by employee number, and my query sorts it in Data Analyzer but not in Analytics Report.

'ORDER BY 'Employee ID''

Any suggestions on how to do this would be greatly appreciated.

10 REPLIES 10

rushikeshvartak
All-Star
All-Star

Share query 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Tejas_Thakkar3
New Contributor
New Contributor

SELECT
U.USERNAME AS 'Employee ID',
U.EMPLOYEETYPE,
U.FIRSTNAME,
U.LASTNAME,
U.EMAIL AS 'Email ID',
U.DEPARTMENTName AS 'DEPARTMENT',
U.REGION,
U.LOCATION AS 'HCM Location',
U.Customproperty52 AS 'Country',
CASE WHEN U.STATUSKEY = 0 THEN 'INACTIVE' ELSE 'ACTIVE' END AS 'USER STATUS',
U.STARTDATE AS 'START DATE',
U.ENDDATE AS 'END DATE',
U.CREATEDATE AS 'CREATED ON',
U.Customproperty28 AS 'AD OU Site Name',
A.ACCOUNTID AS 'Account ID',
E.ENDPOINTNAME AS 'ENDPOINTNAME'
FROM
ACCOUNTS A,
USER_ACCOUNTS UA,
USERS U,
ENDPOINTS E
WHERE
A.ACCOUNTKEY = UA.ACCOUNTKEY
AND U.USERKEY = UA.USERKEY
AND A.ENDPOINTKEY = E.ENDPOINTKEY
AND U.STARTDATE > DATE_SUB(CURDATE(), INTERVAL 7 DAY)
AND U.STATUSKEY = 1
AND U.CUSTOMPROPERTY17 = 'Active'
ORDER BY 'Employee ID'

Saviynt by default sort in ascending first column report


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

@rushikeshvartak Thank you for your response!

The analytics report I am generating does not come with sort.

Saviynt by default sort in ascending first column report

SELECT
    U.USERNAME AS 'Employee ID',
    U.EMPLOYEETYPE,
    U.FIRSTNAME,
    U.LASTNAME,
    U.EMAIL AS 'Email ID',
    U.DEPARTMENTName AS 'DEPARTMENT',
    U.REGION,
    U.LOCATION AS 'HCM Location',
    U.Customproperty52 AS 'Country',
    CASE WHEN U.STATUSKEY = 0 THEN 'INACTIVE' ELSE 'ACTIVE' END AS 'USER STATUS',
    U.STARTDATE AS 'START DATE',
    U.ENDDATE AS 'END DATE',
    U.CREATEDATE AS 'CREATED ON',
    U.Customproperty28 AS 'AD OU Site Name',
    A.ACCOUNTID AS 'Account ID',
    E.ENDPOINTNAME AS 'ENDPOINTNAME'
FROM
    ACCOUNTS A
    JOIN USER_ACCOUNTS UA ON A.ACCOUNTKEY = UA.ACCOUNTKEY
    JOIN USERS U ON U.USERKEY = UA.USERKEY
    JOIN ENDPOINTS E ON A.ENDPOINTKEY = E.ENDPOINTKEY
WHERE
    U.STARTDATE > DATE_SUB(CURDATE(), INTERVAL 7 DAY)
    AND U.STATUSKEY = 1
    AND U.CUSTOMPROPERTY17 = 'Active'
ORDER BY
    U.USERNAME; 

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Analytics Output Tejas_Thakkar3_0-1723536730829.png

 

Its expected behavior as column is first column 


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

NM
Esteemed Contributor
Esteemed Contributor

Try this 

SELECT

U.USERNAME AS 'Employee ID',

U.EMPLOYEETYPE,

U.FIRSTNAME,

U.LASTNAME,

U.EMAIL AS 'Email ID',

U.DEPARTMENTName AS 'DEPARTMENT',

U.REGION,

U.LOCATION AS 'HCM Location',

U.Customproperty52 AS 'Country',

CASE WHEN U.STATUSKEY = 0 THEN 'INACTIVE' ELSE 'ACTIVE' END AS 'USER STATUS',

U.STARTDATE AS 'START DATE',

U.ENDDATE AS 'END DATE',

U.CREATEDATE AS 'CREATED ON',

U.Customproperty28 AS 'AD OU Site Name',

A.ACCOUNTID AS 'Account ID',

E.ENDPOINTNAME AS 'ENDPOINTNAME'

FROM

ACCOUNTS A,

USER_ACCOUNTS UA,

USERS U,

ENDPOINTS E

WHERE

A.ACCOUNTKEY = UA.ACCOUNTKEY

AND U.USERKEY = UA.USERKEY

AND A.ENDPOINTKEY = E.ENDPOINTKEY

AND U.STARTDATE > DATE_SUB(CURDATE(), INTERVAL 7 DAY)

AND U.STATUSKEY = 1

AND U.CUSTOMPROPERTY17 = 'Active'

ORDER BY Employee ID asc 


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'

@NM Thank you for your response!

It is not coming with sort with the above report.

NM
Esteemed Contributor
Esteemed Contributor

@Tejas_Thakkar3 , what format do you need?


If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'