On Thu, 7 Oct 2004 19:22:23 -0700 "Jason Williard" <[EMAIL PROTECTED]> wrote:
> I know that it is possible to do this, though I don't know how. > > I have 2 tables containing information about trouble tickets. One of the tables > (table2) contains information about every ticket ever received, including tickets > that were deleted from the system. For this reason, table2 has ~450,000 records > where table1, which holds the good tickets, has only ~4500. I would like to clear > the useless data out of table2, but don't want to run 450,000 queries to compare > them one row at a time. The two tables share a common id, though one is referred to > as tickid while the other is referred to as ticketidchar. > > Is there an easy way, using just a few queries, to select all the rows in table2 > where ticketidchar does not exist in table1? SELECT table2.id LEFT JOIN table1 ON table1.id = table2.id WHERE table1.id IS NULL; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]