Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Yuri Fadeev / jurasea@yahoo.com
SQL gurus: Single SQL query from 3 tables and conditions?
What are alternatives to get result in single query from following tables and conditions:
table_1:
id_name ... name
1 ......__.......bob
2 ......__.......sam
3 ......__.......jim
4 ......__.......sally
5 ......__.......kelly
6 ......__.......tom
table_2
id_s . succ . id_name .... date
1 ....... 15 .......1 ....... 2011-02-20
2 ....... 26 .......5 ....... 2011-02-21
3 ....... 45 .......4 ....... 2011-02-22
4 ....... 85 .......1 ....... 2011-02-23
5 ....... 11 .......2 ....... 2011-02-24
6 ....... 34 .......6 ....... 2011-02-25
7 ....... 16 .......1 ....... 2011-02-26
8 ....... 70 .......3 ....... 2011-02-27
9 ....... 52 .......5 ....... 2011-03-01
10 ..... 46 .......2 ....... 2011-03-02
11 ....... 5 .......1 ....... 2011-03-05
12 ..... 19 .......3 ....... 2011-03-06
13 ..... 28 .......4 ....... 2011-03-08
14 ..... 56 .......6 ....... 2011-03-09
table_3
id_f . fail . id_name . date
1 ..... 10 .... 3 ..... 2011-02-20
2 ...... 4 ..... 6 ..... 2011-02-21
3 ...... 6 ..... 4 ..... 2011-02-22
4 ..... 12 .... 2 ..... 2011-02-22
5 ..... 17 .... 5 ..... 2011-02-23
6 ..... 24 .... 3 ..... 2011-02-24
7 ..... 13 .... 4 ..... 2011-02-25
8 ..... 31 .... 1 ..... 2011-02-25
9 ..... 29 .... 2 ..... 2011-02-26
10 ... 15 .... 5 ..... 2011-02-26
11 .... 3 ..... 1 ..... 2011-02-27
12 .... 1 ..... 2 ..... 2011-02-28
13 .... 4 ..... 4 ..... 2011-03-01
14 .... 8 ..... 3 ..... 2011-03-01
15 .... 5 ..... 2 ..... 2011-03-02
16 .... 6 ..... 5 ..... 2011-03-02
17 .... 4 ..... 4 ..... 2011-03-03
18 .. 15 ..... 4 ..... 2011-03-04
19 .... 2 ..... 3 ..... 2011-03-05
20 .. 18 ..... 5 ..... 2011-03-05
21 .. 22 ..... 1 ..... 2011-03-06
22 .... 5 ..... 4 ..... 2011-03-07
23 .... 1 ..... 2 ..... 2011-03-08
24 .. 19 ..... 6 ..... 2011-03-09
Report conditions:
Fields: Name _ Sum(succ) _ Sum(fail) _ Count(succ) _ Count(fail)
Period: date>=2011-02-22 & date<=2011-03-05
SortByName
Report result:
name Sum(succ) Sum(fail) Count(succ) Count(fail)
bob ........ 106 .......... 34 .......... 3 ............ 2
jim ........... 70 .......... 34 .......... 1 ............ 3
kelly ........ 52 ........... 56 ......... 1 ............ 4
sally ........ 45 ........... 42 ......... 1 ............ 5
sam ......... 57 ........... 47 ......... 2 ........... 4
tom ......... 34 ............. 0 ......... 1 ............ 0
Thanks in advance.
Actually I have more than million rows, and looks like MySQL does my query forever (creating tmp table).. I've waited for 1 hour with no output..
2 AnswersProgramming & Design1 decade agoWhy "top-10-answerers" list leaders allowed to cheat from multiple accounts (point-game)?
♦ 1) Why Yahoo team allows violation of community guidelines about point-game from multiple accounts?
♦ 2) Why they doesn't check IP-access reports to clear cheaters from "top-10-answerer" lists?
♦ 3) Why reporting such activity is useless against "top-10-answerer" lists leaders?
( both - to y_answrs_team@yahoo.com or by reporting abuse)
Even if there are enough evidence (so probability of cheating is 99%)?
♦ 4) Do these leaders just pay money to remain invincible?
♦ 5) Is it acceptable if I will start to cheat this way? Will team discriminate me by deleting my account but leaving other cheaters accounts in top-list?
Thanks for any relevant answers and explanations
BR, Jurij.
4 AnswersYahoo Answers1 decade ago