I have two tables. One table, which (to protect the innocent :-)) we'll 
call MainTable, has a list of names with user info like address, etc.. 
and an auto-incrementing unique id for each.  The other, which we'll 
call MapTable, is simply a key mapping table with ids from MainTable 
that just basically holds a list of MainTable ids to specify some sort 
of property (be it that they are disabled or whatever)

Table: MainTable
ID  |   NAME
--------------------------------
1      Foo
2      Bar

Table: MapTable
ID
-------
2  <-- referring to the MainTable ID field

I am trying to query the list of records in MainTable that are NOT 
mapped in MapTable.  The query I am using is as follows:

select MainTable.ID from MainTable,MapTable where MainTable.ID != 
MapTable.ID;

this query works perfectly on a table with 10 records but when you get 
into the millions it takes quite a long time.  Is there a faster way to 
get what I want?

Thanks,
Augey




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