Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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 ;
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.
What is the error your are getting here? Did you connect to your correct database?
I get a message that blank field name is not allowed
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 ;
That was it. Thank you