Hello Alejandro,
well, thanks for your help, but it's not quite what I'm looking for...
Well, I'm working on a stats application. That query should display all referrers ordered by how many hits they sent me in the last 24h. Each access to the homepage is being logged in the MySQL DB with a new entry. That's why I want to do this combined "id, count(*)" query.
Incoming='1' means that this id (referrer) hast sent me one hit, incoming='0' means I have sent one user to the referrer.
Well, I try to do now a little list of what it should look like then:
ID | incoming
ref1 1
ref1 1
ref1 0
ref10 1
ref1 1
ref100 0
ref100 1
ref1 1
ewf100 1
I need then to order this by ID and I need to retrieve how many times a unique ID has a value of '1' in the incoming column and this should then be ordered desc the count value
ID | Count
ref1 4
ref100 2
ref10 1
and then I need somehow to access the ID and its count value....
What I've been also thinking on is just making a query like this:
$query = "SELECT id, COUNT(*) FROM $table1 WHERE incoming='1' and id!='' GROUP BY id;
$insert = MYSQL_QUERY($query);
wouldn't that return some kind of array, which then could be ordered by PHP??? Well, I admit, my knowledge on arrays is not very good and I try to avoid them as often as possible.
Thanks for your help,
Stephan