|
Thanks Michael...that works too. Anyone know what's more efficient - an
exception join or a subselect? Probably depends, eh?
On Thu, Mar 26, 2009 at 10:07 AM, <Michael_Schutte@xxxxxxxxxxxx> wrote:
<E%3AAShore@xxxxxxxxxxx <E%253AAShore@xxxxxxxxxxx><
SELECT a.SKU, a.Name, a.Category
FROM TABLEA a
EXCEPTION JOIN TABLEB b
ON a.SKU = b.SKU
And a.Category = b.category
Michael Schutte
Admin Professional
We've wrapped up a whole new breakfast adventure in Bob Evans BOBurrito.
Premiering at 5.99. For more information and to enter the FREE Breakfast
Every Week for a Year Sweepstakes ($500 value), visit www.BOBurrito.com
Michael Ryan
<michaelrtr@gmail
.com> To
Sent by: Midrange Systems Technical
midrange-l-bounce Discussion
s@xxxxxxxxxxxx <midrange-l@xxxxxxxxxxxx>
cc
03/26/2009 09:59 Subject
AM Re: SQL Union Join?
Please respond to
Midrange Systems
Technical
Discussion
<midrange-l@midra
nge.com>
Thanks Alan...I did this, and it looks like it's working:
SELECT a.SKU, a.Name, a.Category
FROM TABLEA a, TABLEB b WHERE a.SKU = b.SKU And
a.Category not in (select b.category from TABLEB b where a.sku_number =
b.sku_number)
Folks, does this make sense? How can I improve on this?
On Thu, Mar 26, 2009 at 9:44 AM, Alan Shore <AlanShore@xxxxxxxx> wrote:
How about the following
select b.col1, b.col2, b.col3 from tableb b where not exists
(select * from tablea a where
a.col3 = b.col3)
or something similar
This is untested so I may have got something wrong
Alan Shore
Programmer/Analyst, Distribution
E:AShore@xxxxxxxxxxx <E%3AAShore@xxxxxxxxxxx> <E%3AAShore@xxxxxxxxxxx<E%253AAShore@xxxxxxxxxxx>>
E%253AAShore@xxxxxxxxxxx <E%25253AAShore@xxxxxxxxxxx>>
I
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill
midrange-l-bounces@xxxxxxxxxxxx wrote on 03/26/2009 09:30:52 AM:
If I have two tables (TABLEA, TABLEB) that have the same format, and
Iwantmatch,
to retrieve all the rows where a combination of two columns don't
would that be a union join? If so, how is that specified? Here's what
couldhave:
TABLEA and TABLE have the format of SKU, name and category. A SKU
mailingexist in multiple categories.having
TABLEA
123, NAME1, 1001
456, NAME2, 1002
123, NAME1, 1002
789, NAME3, 1004
TABLEB
001, SOMETHING, 1002
123, NAME1, 1003
456, NAME2, 1002
123, NAME1, 1002
I want to retrieve 123, NAME1, 1003 because that's the one that has a
different category. I don't want to retrieve SKU 456, 789, or 001.
Hmmm...maybe I need to match on SKU with a subselect for that SKU not
that category?
Thanks!
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
listlistlist
To post a message email: MIDRANGE-L@xxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxxlist
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.