[PHP/MySQL] Auslesen von "COUNT( DISTINCT ( d.customers_id ) )"?

Suchfunktion

Erfahrenes Mitglied
Hi!

Ich habe folgende Datenbankabfrage:
Code:
SELECT ab.entry_country_id, c.countries_name, COUNT( DISTINCT (
d.customers_id
) )
FROM customers d, address_book ab, countries c
WHERE ab.customers_id = d.customers_id AND c.countries_id = ab.entry_country_id
GROUP BY countries_name ASC

Diese Abfrage habe ich im phpMyAdmin mal ausgefuehrt und folgende Spalten kamen dabei heraus:
"entry_country_id", "countries_name", "COUNT( DISTINCT ( d.customers_id ) )"

Ich brauche die Inhalte der zweiten und dritten Spalte.
Die erste Spalte ist auch kein Problem mit dem Abrufen:
PHP:
	$sql_demo_country = "SELECT ab.entry_country_id, c.countries_name, COUNT(distinct(d.customers_id)) 
							FROM customers d, address_book ab, countries c 
							WHERE ab.customers_id = d.customers_id 
							AND c.countries_id = ab.entry_country_id 
							GROUP BY countries_name ASC";
	$rs_demo_country = mysql_query($sql_demo_country);
	$customers_country_cnt = mysql_num_rows($rs_demo_country);
	while($customers_all_country = mysql_fetch_assoc($rs_demo_country)){		
		$countries_name = $customers_all_country['countries_name'];
		# Hier soll das Auslesen der dritten Spalte hin..
	}
Aber wie rufe ich die dritte Spalte ab?
PHP:
$countries_count = $customers_all_country['customers_id'];
und
PHP:
[$countries_count = $customers_all_country['COUNT( DISTINCT ( d.customers_id ) )'];
funktionieren nicht :(

Bin fuer eure Hilfe dankbar
See ya.

mfg
 

Neue Beiträge

Zurück