HI,
>If I understand your question, you need two queries:
>
>select count(*) as count, ip, value from log group by ip
>
>select count(*) as count, ip, value from log group by ip,value

that leads to the right direction! thanks! It shows me a the ips with
their values and how many times they are in the table.
That brings me somehow nearer to the solution but I am still getting mad
about not finding exactly what I need (you know that feeling? it´s like
having jam in the head!) I want to get the number of rows which have the
same ip and same/different value. The questions are:

1. How many rows have same values for field x and y?
2. How many ips have different values for field x (and same field y)?
   (more interesting)

Let´s have a test-table:
id value timestamp 
 1   a  
 1   a  
 2   a  
 2   b  
 3   a  
 3   a  
 3   b  

The queries should return in this case:
1. 4 rows (have same id/value)
2. 2 (ids have different values for for field 'value')

As I am seeking differences here, after this it will be interesting to
see a list of this 2 ids and their values:
id val
2  a
2  b
3  a
3  b

So I could make it to:
There are 2 different values for id "2" : a,b
There are 2 different values for id "3" : a,b

Maybe you got an idea?
        
Many thanks for your attention!


A small table for testing:

CREATE TABLE test (
   id tinyint(1) DEFAULT '0' NOT NULL,
   value char(1) NOT NULL
);

#
# Dumping data for table 'test'
#

INSERT INTO test VALUES ( '1', 'a');
INSERT INTO test VALUES ( '1', 'a');
INSERT INTO test VALUES ( '2', 'a');
INSERT INTO test VALUES ( '2', 'b');
INSERT INTO test VALUES ( '3', 'a');
INSERT INTO test VALUES ( '3', 'a');
INSERT INTO test VALUES ( '3', 'b');


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to