Ashish,
This is not exacly your case but with this SQL I can compare two tables (same structure) in different libraries, the first column (at the left in result example) is ULUSER alias SYS, is from library SYS810 which has values that are not included in right side table (library L070TSCTL).
SELECT A.ULUSER AS SYS, B.ULUSER AS CTL FROM
SYS810/F00921 A
LEFT OUTER JOIN L070TSCTL/F00921 B ON A
.ULUSER = B.ULUSER WHERE B.ULUSER IS
NULL
You will see something like this:
....+....1....+....2....+....3....+....4..
SYS CTL
CONSCNC -
CONSDV -
CONSF -
LACCT -
Good luck,
Alberto.
-----Original Message-----
From: java400-l-bounces+alberto_zeledon=premierway.com@xxxxxxxxxxxx on behalf of Ashish Kulkarni
Sent: Wed 7/25/2007 4:58 PM
To: java400-l@xxxxxxxxxxxx
Cc:
Subject: SQL question
Hi
I have 2 tables which has similar structure, i want to
write a sql statement to compare the 2 tables and find
the missing keys from one
For example
Table 1
Key Description
001 This is one
002 This is two
Table 2
Key Description
001 this is one
Now i want to write a query to find out, 002 is
missing in table 2, and may be a query to insert 002
into table2
Any ideas?
Ashish
A$HI$H
____________________________________________________________________________________Ready for the edge of your seat?
Check out tonight's top picks on Yahoo! TV.
http://tv.yahoo.com/
--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.