I have 2 MYSQL base queries which dependent on each other, here are my quires
@$query = "SELECT * FROM coins_tokens";
$row = $db->Execute($query);
foreach ($row as $rowItem) {
$name = $rowItem['ct_id'];
@$sql1 = "SELECT * FROM historical_data WHERE `name` = '".$name."' GROUP BY name LIMIT 30";
$row2 = $db->Execute($sql1);
foreach ($row2 as $rowItem2){
$market_cap = $rowItem2['market_cap'];
if($market_cap >= 500000000){
}
}
}
It slow down my whole process and take lot of time to execute, as there are more then 1400 results in coins_tokens
, then there are more then 600000 records again 1st table, in both table ct_id
and name
are conman.
And what I am trying to do is to get the currencies which have more then 500million market_cap
in last 7 days. So am fetching the currencies from 1st table and there historical data from 2nd table and checking if market_cap
there increased in last 7 days.
Here is the structure and data of historical_data table: