I have the following tables:
Fans
id, id_page, number_of_fans, created_at
This table has many same id_page
but it differs in created_at
Page
id, id_facebook, id_keyword, is_processed (0/1)
keyword
id, keyword, category
I am experimenting/trying sub-queries but I didn't get the result that I wanted, sometimes the query is very slow because of its complexity.
I would like the result to:
- I will get the latest(
created_at
) - (returns only 1 row from tablefans
per page) -number_of_fans
infans
table by page and get the sum of allnumber_of_fans
by group bykeyword
- I will get all the pages group by
keyword
- I will get all the pages group by
keyword
whereis_processed
= 1
How will it be possible to combine the result of 1, 2, 3 with just 1 query in MySQL?
Thank you.
Regards, bhadz