muneeba9071
10-31-2012, 05:41 PM
Hi,
I need help to make these two queries as 1 query:
$results_top_ips = $wpdb->get_results("SELECT ip FROM keywords GROUP BY ip ");
foreach($results_top_ips as $row) {
$total_visits = $wpdb->get_row("SELECT COUNT(*) AS total_visits FROM keywords WHERE ip = '{$row->ip}' ")->total_visits;
Is it possible to put the total_visits in the first query, so then I can also do a ORDER BY total_visits DESC within the first query.
Thanks in advance!
I need help to make these two queries as 1 query:
$results_top_ips = $wpdb->get_results("SELECT ip FROM keywords GROUP BY ip ");
foreach($results_top_ips as $row) {
$total_visits = $wpdb->get_row("SELECT COUNT(*) AS total_visits FROM keywords WHERE ip = '{$row->ip}' ")->total_visits;
Is it possible to put the total_visits in the first query, so then I can also do a ORDER BY total_visits DESC within the first query.
Thanks in advance!