>Hi,
>
>This is my first posting, although i've been signed up to the list for a
>while.
>
>My problem is this.
>
>Table A (5000 rows)
>ID, NAME, SCORE
>
>Table B (1000 rows)
>ID, NAME, SCORE
>
>I want all records from Table A and those from Table B where they match, for
>this i'm using a right join.  However, there are rows in Table B which don't
>match any in Table A, but i need to include these as well.
>Any help would be appreciated.
>
>Ben.

Sir, I haven't seen an answer to your question, so here's one way of 
getting what you want.

What you want is basically the union of three groups of rows: the 
rows from A and B that match, the rows from A that don't match B, and 
the rows from B that don't match A. Your outer join returns the first 
two groups. The last group is returned by a difference query: the 
rows in B that don't match any of the rows in A (B - A). Since MySQL 
doesn't yet support UNION, you will have to load the result tables 
from both queries into another table, and then SELECT * from that 
table.

I have a description of the standard difference query on my website; 
http:/users.starpower.net/rjhalljr, click on MySQL on the sidebar, 
click on SQL, and look for the difference query topic.

Bob Hall

Know thyself? Absurd direction!
Bubbles bear no introspection.     -Khushhal Khan Khatak

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