lundi 31 août 2015

Why am I not getting any data using these HQL queries?

I use this query to pull the highest encounter from the highest chapter a user has reached:

SELECT COUNT(hc.s) as users, highest_chapter, highest_encounter
FROM
(SELECT s, MAX(l) as highest_chapter
FROM appl9_evt
WHERE month = "201508" AND st1 = "player" AND st2 = "level_progression" AND n = "level_start"
GROUP BY s
ORDER BY highest_chapter) hc
INNER JOIN
(
SELECT s, l, MAX(get_json_object(json_data, '$.CurrentEncounter')) as highest_encounter 
FROM appl9_evt
WHERE month = "201508" AND st1 = "player" AND st2 = "level_progression" AND n = "level_start"
GROUP BY s, l
ORDER BY highest_encounter
) he
ON hc.s = he.s AND hc.highest_chapter = he.l 
GROUP BY highest_chapter, highest_encounter

Then I save it as a table and try to get only version 2.2.1 (or whatever version, a self-join I think it's called) with this:

SELECT COUNT(DISTINCT highest.s) as users, highest_chapter, highest_encounter FROM
(SELECT users as s, highest_chapter, highest_encounter 
FROM augusers221 ) highest
JOIN
(SELECT s 
FROM appl9_cpu
WHERE v_maj = '2.2.1') ver
ON highest.s = ver.s
GROUP BY highest_chapter, highest_encounter
ORDER BY highest_chapter, highest_encounter

But there's something wrong with this second stage, because I can't pull any data... Thank you in advance for looking at this wall of text.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire