* Simon Green
> After running this simple question I get this error. I have looked at the
> my.cnf file and all looks fine and the system has 1.256 G of memory.
> Can some one please tell me where I have gone wrong.
>
> select in_names.Username
> from in_names, in_names2
> where in_names.Username != in_names2.Username;
> ./mysql: Out of memory (Needed 8164 bytes)
> ERROR 2008: MySQL client run out of memory
If you have many names in these tables, this will consume a lot of memory,
yes. You are asking for all combinations of names where the name is not the
same.
This is an example with only five names in each table:
mysql> create table in_names (Username varchar(30));
Query OK, 0 rows affected (0.02 sec)
mysql> insert into in_names values("aaa"),("bbb"),("ccc"),("ddd"),("eee");
Query OK, 5 rows affected (0.01 sec)
Records: 5 Duplicates: 0 Warnings: 0
mysql> create table in_names2 select * from in_names;
Query OK, 5 rows affected (0.03 sec)
Records: 5 Duplicates: 0 Warnings: 0
mysql> select in_names.Username,in_names2.Username
-> from in_names, in_names2
-> where in_names.Username != in_names2.Username;
+----------+----------+
| Username | Username |
+----------+----------+
| bbb | aaa |
| ccc | aaa |
| ddd | aaa |
| eee | aaa |
| aaa | bbb |
| ccc | bbb |
| ddd | bbb |
| eee | bbb |
| aaa | ccc |
| bbb | ccc |
| ddd | ccc |
| eee | ccc |
| aaa | ddd |
| bbb | ddd |
| ccc | ddd |
| eee | ddd |
| aaa | eee |
| bbb | eee |
| ccc | eee |
| ddd | eee |
+----------+----------+
20 rows in set (0.00 sec)
I selected both names, so that you can see what is going on. Each name in
one table is matched with _every_ name in the other table, except the one
that is the same... just as you asked for. :)
--
Roger
---------------------------------------------------------------------
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