Created
June 3, 2013 15:34
-
-
Save arialdomartini/5699027 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L'errore è in | |
select normalized_w, denormalized_w from tmp_denormalized r where | |
r.score = ( | |
select max(score) from tmp_denormalized d where r.normalized_w = d.normalized_w | |
group by normalized_w | |
); | |
perché estrae più righe nel caso in cui due parole abbiano lo stesso score. | |
Per esempio, nel caso di | |
Normalized, denormalized, score | |
java, java developer, 100 | |
java, developer java, 100 | |
java, altro, 80 | |
restituirebbe 2 righe | |
Lo abbiamo corretto così: | |
select | |
normalized_w, | |
max(denormalized_w), | |
score | |
from | |
tmp_denormalized | |
inner join | |
(select | |
normalized_w as a, | |
MAX(score) as m | |
from | |
tmp_denormalized | |
group BY | |
normalized_w) as m | |
ON tmp_denormalized.normalized_w = m.a and tmp_denormalized.score = m.m | |
group by | |
normalized_w, score |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment