Hi
I've the following basic table
login_id
email_address
ip_address
I want to extract all records from this table in which a user has used the
same IP address but different email address to login ?
Thanks,
Neil
Hi Neil,
select
login_id,
ip_address
from
basic_table
group by
login_id,ip_address
having
count(login_id,ip_address)1
this should work
in case you want to see also the list of emails add:
group_concat(email_address,',') as list_of_used_emails
to the select fields.
Claudio
Hi all,
I have just experienced a strange problem with mysql production database. The
table faqsessions have a primary key on column `Code` and the above select
return 2 rows!
mysql
mysql
mysql show create table faqsessions;
Is it possible that someone did an alter table disable keys at some point,
maybe for a bulk load, and forgot to re-enable them ?
- Original Message -
From: Rodrigo Ferreira rodrigof_si...@yahoo.com
To: mysql@lists.mysql.com
Sent: Wednesday, 2 March, 2011 3:04:31 PM
Subject: Two
-Original Message-
From: Tompkins Neil [mailto:neil.tompk...@googlemail.com]
Sent: Wednesday, March 02, 2011 6:00 AM
To: [MySQL]
Subject: Query help
Hi
I've the following basic table
login_id
email_address
ip_address
I want to extract all records from this table in which a user has
Thanks for the response. This is what I was after. Although, I am looking
to find out the email addresses used to login from the same IP ?
On Wed, Mar 2, 2011 at 2:49 PM, Jerry Schwartz je...@gii.co.jp wrote:
-Original Message-
From: Tompkins Neil
Hi Johan,
It seems InnoDB doesn't support disable/enable keys.
mysql alter table faqsessions enable keys;
Query OK, 0 rows affected, 1 warning (0.14 sec)
mysql show warnings;
+---+--+-+
| Level | Code |
Message
If you want one row for each combination, you'll need either a temporary table
or a sub-query. Try this:
SELECT ip_address, login_id
FROM basic_table
JOIN
(SELECT
ip_address
FROM
basic_table
GROUP BY
ip_address
HAVING
COUNT(*) 1) AS x
Anyone knows how to get the server* IP address* thru SQL?
--
Claudio
*mysql select * from GLOBAL_variables where variable_name like 'hostname';*
*+---++*
*| VARIABLE_NAME | VARIABLE_VALUE |*
*+---++*
*| HOSTNAME | haarlemeer |*
Am 03.03.2011 00:31, schrieb Claudio Nanni:
Anyone knows how to get the server* IP address* thru SQL?
no, because it is nonsense and has nothing to do with a db-server
if you connect via tcp you know the ip
and even if not - what should give you mysqld
if the host has more than one ip?
10 matches
Mail list logo