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



----- Original Message -----
From: "Peter Holm" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 16, 2001 3:44 PM
Subject: Please help me finding a sql-statement


Hi,
it is quite easy, I thought, but I can´t find it...
there is a table, which is used as a simple "logging table", so there is
only

ip | value | time

ip is not unique, neither is value.
ip and value in different rows can have the same values but sometimes
they differ, that´s the point!

I want to extract all the same ips with different values. I want to
know, how many ips with the same ip and value exist and how many with
same ip but different value.

in simple sql (a language people like me would like to exist) it would
be:
select count(*) from table where ip=ip and value<> value.
and
select ip from table where ip=ip and value<> value.

Of course that doesn´t work.

I tried some self-joins and experimented with group by and having, but
most of the time I get astronomical values after waiting a long time :(

Could someone please give me a hint???

Thanks for your attention!





Have a nice thread,
Peter

---------------------------------------------------------------------
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



---------------------------------------------------------------------
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