Created
November 4, 2019 19:32
-
-
Save Haguilar91/992e35d527083c69683b5b5cee6cd8f3 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
int acum_help=0; | |
int acum_unhelp=0; | |
int question_id=0; | |
int question_id_starter=0; | |
for (int i = 0 ;i < table.rowlength; i++ ) | |
if(i=0) | |
question_id_starter = row.question_id | |
endif | |
if (row.is_useful = 1)&& (question_id_starter==row.questionid) | |
acum_help ++; | |
else if (question_id_starter==row.questionid) | |
acoum_unhelp++; | |
else | |
question_id_starter = row.question_id | |
INSERT INTO temp_ratings (question_id,acum_help,acum_unhelp) VALUES (question_id,acum_help,acum_unhelp); | |
acum_help = 0 | |
acum_unhelp = 0 | |
endif | |
if(i=table.rowlenght) | |
INSERT INTO temp_ratings (question_id,acum_help,acum_unhelp) VALUES (question_id,acum_help,acum_unhelp); | |
endif | |
endfor | |
select | |
count(*) as count_flagged | |
from temp_ratings | |
where (unhelpful>helpful) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment