Re: differences

From: Alan <alanshein_at_erols.com>
Date: Wed, 30 Jan 2002 12:17:09 -0500
Message-ID: <a399lk$16r0kb$1_at_ID-114862.news.dfncis.de>


If I understand what you want correctly, try this:

SELECT * FROM
(
(
SELECT DISTINCT position, textline
FROM table_a
)
MINUS
(
SELECT DISTINCT position, textline
FROM table_b
)
)
UNION
(
(
SELECT DISTINCT position, textline
FROM table_b
)
MINUS
(
SELECT DISTINCT position, textline
FROM table_a
)
)
ORDER BY position

Think I have the syntax correct...

"Nis Jorgensen" <nis_at_dkik.dk> wrote in message news:n1df5ugnqkpuiapvb5fhu392vo117c38at_at_4ax.com...
> On 29 Jan 2002 09:44:13 -0800, mikharakiri_at_yahoo.com (Mikito Harakiri)
> wrote:
>
> >table A (
> > position NUMBER,
> > textline VARCHAR2
> >);
> >
> >table B (
> > position NUMBER,
> > textline VARCHAR2
> >);
> >
> >what is a SQL query that returns all the differences between A and B?
> >It is important that position is used for ordering only, so that it is
> >pretty much like I'm comparing 2 text files. UNIX diff utility does
> >exactly that, but query must be superior, right?-)
>
> Define EXACTLY what you want as the output - then we might be able to
> tell you how to get it.
>
> For instance:
>
> Insert into A values ((1, 'Text1'), (2, 'Text2'));
>
> Insert into B values ((1, 'Text2'),(2, 'Text1')
>
> Which result set do you want?
>
> No matter what you end up wanting, don't expect it to be easy in SQL
> (put probably possible).
>
> --
> Nis Jorgensen
> Amsterdam
>
> Join the Patti Beadles Fan Club!
> Details to follow.
Received on Wed Jan 30 2002 - 18:17:09 CET

Original text of this message