Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

rittermd
Honored Contributor

Script Coding Question

I was provided with this standard sql code by a developer and am having trouble figuring out how to get it setup in QS script to work properly.  Any advice would be greatly appreciated.

SELECT tp.sessionkey, COUNT(*)

FROM transactions te

JOIN transactions tp ON tp.k = te.parentkey

WHERE te.srcfile LIKE '2018-05-09%'

AND te.worktype IN ('envelope')

GROUP BY tp.sessionkey ;


Thanks

1 Solution

Accepted Solutions
Employee
Employee

Re: Script Coding Question

Try adding a name for the count column:

SELECT tp.sessionkey, COUNT(*) AS NrSessions

FROM transactions te

JOIN transactions tp ON tp.k = te.parentkey

WHERE te.srcfile LIKE '2018-05-09%'

AND te.worktype IN ('envelope')

GROUP BY tp.sessionkey ;

5 Replies
JustinDallas
Valued Contributor II

Re: Script Coding Question

What's the issue?  Are you trying to put the SQL in a load statement? i.e

Transactions:

LOAD *

;

SQL SELECT tp.sessionkey, COUNT(*)

FROM transactions te

JOIN transactions tp ON tp.k = te.parentkey

WHERE te.srcfile LIKE '2018-05-09%'

AND te.worktype IN ('envelope')

GROUP BY tp.sessionkey

;

Or is something not parsing correctly.

vishsaggi
Esteemed Contributor III

Re: Script Coding Question

What is the error your are getting here? Did you connect to your correct database?

rittermd
Honored Contributor

Re: Script Coding Question

I get a message that blank field name is not allowed

Employee
Employee

Re: Script Coding Question

Try adding a name for the count column:

SELECT tp.sessionkey, COUNT(*) AS NrSessions

FROM transactions te

JOIN transactions tp ON tp.k = te.parentkey

WHERE te.srcfile LIKE '2018-05-09%'

AND te.worktype IN ('envelope')

GROUP BY tp.sessionkey ;

rittermd
Honored Contributor

Re: Script Coding Question

That was it.  Thank you

Community Browser