You're making the assumption that he's using 4.1.x. He
didn't state which version he's using so your solution
may be of no use to him.

-- T

--- Matt Warden <[EMAIL PROTECTED]> wrote:

> On Fri, 06 Aug 2004 13:17:42 -0400, Michael Stassen
> <[EMAIL PROTECTED]> wrote:
> > You need a LEFT JOIN:
> > 
> >    SELECT ticket_number
> >    FROM purchased_items LEFT JOIN purchases
> >    ON purchased_items.ticket_number =
> purchases.ticket_number
> >    WHERE purchases.ticket_number IS NULL;
> 
> 
> No, actually he doesn't.
> 
> SELECT ticket_number
> FROM purchased_items
> WHERE ticket_number NOT IN 
>           (SELECT ticket_number FROM purchases);
> 
> The above will most certainly be faster than any
> join, because it is
> only a couple projections and a simple selection
> over ticket_number
> (which is almost certainly indexed).
> 
> Although, I suppose if this is only a maintenance
> query (I suspect it
> is), then it probably doesn't matter. But, the
> bottom line is: if you
> can avoid join, do it. There's only so much the
> query optimizer can
> do.
> 
> 
> 
> 
> -- 
> 
> Matt Warden
> Berry Neuroscience Lab
> Department of Psychology
> Miami University
> 
> 
> 
> This email proudly and graciously contributes to
> entropy.
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:   
>
http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 



                
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to