Please help me in making a SQL script for DB2 that Subtract result of 3 queries from a 4. query
I would like to subtract results from query B,C,D from query result of A.
The end result is a list of valid scratch tapes for free slots in a TSM tape robot. At the moment i'm using external scripting from a client computer with ODBC. I want to have it all on the server and it would be nice to have it all in SQL script, can you help me...DB2 Newbe
Select statments:
A.:
SELECT DISTINCT VOLHISTORY.VOLUME_NAME FROM VOLHISTORY VOLHISTORY ORDER BY VOLHISTORY.VOLUME_NAME
B.:
SELECT DRMEDIA.VOLUME_NAME FROM DRMEDIA DRMEDIA
C.:
SELECT LIBVOLUMES.VOLUME_NAME FROM LIBVOLUMES LIBVOLUMES
D.:
SELECT VOLUMES.VOLUME_NAME FROM VOLUMES VOLUMES WHERE (VOLUMES.STGPOOL_NAME<>'DISK_BU')
Results from above select statments
a.:
DEC500
DEC501
DEC502
DEC503
DEC504
DEC505
DEC506
DEC507
DEC508
DEC509
DEC510
DEC511
DEC512
DEC513
DEC514
DEC515
DEC516
DEC517
DEC518
DEC519
DEC520
DEC521
DEC522
DEC523
DEC524
DEC525
DEC526
DEC527
b.:
DEC501
DEC502
DEC504
DEC505
DEC506
DEC508
DEC514
DEC511
DEC512
c.:
DEC500
DEC503
DEC507
DEC508
DEC509
DEC510
DEC513
DEC515
DEC522
DEC524
d.:
DEC500
DEC501
DEC502
DEC504
DEC505
DEC506
DEC507
DEC508
DEC509
DEC515
DEC522
B,C,D subtracted from A.:
DEC516
DEC517
DEC518
DEC519
DEC520
DEC521
DEC523
DEC525
DEC526
DEC527
I would like to subtract results from query B,C,D from query result of A.
The end result is a list of valid scratch tapes for free slots in a TSM tape robot. At the moment i'm using external scripting from a client computer with ODBC. I want to have it all on the server and it would be nice to have it all in SQL script, can you help me...DB2 Newbe
Select statments:
A.:
SELECT DISTINCT VOLHISTORY.VOLUME_NAME FROM VOLHISTORY VOLHISTORY ORDER BY VOLHISTORY.VOLUME_NAME
B.:
SELECT DRMEDIA.VOLUME_NAME FROM DRMEDIA DRMEDIA
C.:
SELECT LIBVOLUMES.VOLUME_NAME FROM LIBVOLUMES LIBVOLUMES
D.:
SELECT VOLUMES.VOLUME_NAME FROM VOLUMES VOLUMES WHERE (VOLUMES.STGPOOL_NAME<>'DISK_BU')
Results from above select statments
a.:
DEC500
DEC501
DEC502
DEC503
DEC504
DEC505
DEC506
DEC507
DEC508
DEC509
DEC510
DEC511
DEC512
DEC513
DEC514
DEC515
DEC516
DEC517
DEC518
DEC519
DEC520
DEC521
DEC522
DEC523
DEC524
DEC525
DEC526
DEC527
b.:
DEC501
DEC502
DEC504
DEC505
DEC506
DEC508
DEC514
DEC511
DEC512
c.:
DEC500
DEC503
DEC507
DEC508
DEC509
DEC510
DEC513
DEC515
DEC522
DEC524
d.:
DEC500
DEC501
DEC502
DEC504
DEC505
DEC506
DEC507
DEC508
DEC509
DEC515
DEC522
B,C,D subtracted from A.:
DEC516
DEC517
DEC518
DEC519
DEC520
DEC521
DEC523
DEC525
DEC526
DEC527