...
FROM `trending`
JOIN `trending_overall`
ON `trending_overall`.`product_id` = `trending`.`id`
WHERE `trending_overall`.`date` = 1568662153
...
znaci koristis za join key:
trending_overall.product_id -> KEY `product_id` (`product_id`),
trending.id -> PRIMARY KEY (`id`)
za where teoretski mozes da koristis:
KEY `date` (`date`)
a pitanje dal ce ga koristiti ili ne od kardinalnosti
i onda ceo taj rezultat:
...
ORDER BY `review_score_daily` DESC
LIMIT 50;
sortiras i vracas prvih 50 ..
pitanje .. sta ti kaze
SELECT COUNT(*)
FROM `trending`
JOIN `trending_overall`
ON `trending_overall`.`product_id` = `trending`.`id`
WHERE `trending_overall`.`date` = 1568662153;
dalje, uradi
SELECT `trending`.`id`,
`trending`.`asin`,
`trending`.`url`,
`trending`.`title`,
`trending`.`brand`,
`trending`.`category`,
`trending`.`image`,
`trending`.`price`,
`trending`.`likes_overall`,
`trending`.`review_score`,
`trending`.`review_score_overall`,
`trending`.`date_found`,
`trending`.`date_srapped`,
`trending`.`saved`,
`trending`.`date_saved`,
`trending_overall`.`likes`,
`trending_overall`.`review`,
`trending_overall`.`overall_review_percentage` AS `review_score_daily`,
`trending_overall`.`overall_likes_percentage` AS `likes_daily`
FROM `trending`
JOIN `trending_overall`
ON `trending_overall`.`product_id` = `trending`.`id`
-- WHERE `trending_overall`.`date` = 1568662153
ORDER BY `review_score_daily` DESC
LIMIT 50;
koliko traje i na sta mu lici explain
onda
SELECT `trending`.`id`,
`trending`.`asin`,
`trending`.`url`,
`trending`.`title`,
`trending`.`brand`,
`trending`.`category`,
`trending`.`image`,
`trending`.`price`,
`trending`.`likes_overall`,
`trending`.`review_score`,
`trending`.`review_score_overall`,
`trending`.`date_found`,
`trending`.`date_srapped`,
`trending`.`saved`,
`trending`.`date_saved`,
`tdo`.`likes`,
`tdo`.`review`,
`tdo`.`overall_review_percentage` AS `review_score_daily`,
`tdo`.`overall_likes_percentage` AS `likes_daily`
FROM `trending`
JOIN (SELECT `product_id`,
`likes`,
`review`,
`overall_review_percentage`,
`overall_likes_percentage`
FROM `trending_overall`
WHERE `date` = 1568662153) tdo
ON `tdo`.`product_id` = `trending`.`id`
ORDER BY `review_score_daily` DESC
LIMIT 50;
daj vreme i explain za ovaj zadnji