hello
is there a way to get SUM of COUNT(*) AS user_id of two tables in one query?
this code shows only table rtv ID : NAME but I need ID: NAME + COUNT SUMMARY
PHP Code:$sql = "SELECT blah.* FROM rtv AS blah LEFT JOIN (SELECT mes_id_fk, COUNT(*) AS user_id FROM vote_ip WHERE date> (NOW() - INTERVAL 2592000 SECOND) GROUP BY mes_id_fk) AS top_voted ON blah.id = top_voted.mes_id_fk ORDER BY top_voted.user_id DESC limit 5";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$list .= "".$row[id].": ".$row[naslov]." <br>";
}
echo $list;



Reply With Quote







Bookmarks