Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User query results in another query

Status
Not open for further replies.

dabrus

IS-IT--Management
May 31, 2000
1
US
I would like to use the results of one query in another query. How could I complete this in WF7?

Example:
Code:
SQL DB2 SET SERVER DB2_SERVER
SQL DB2
Select USERNAME from TST.USERS for read only with ur
;
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD
END
TABLE FILE HOLD
PRINT
*
ON TABLE HOLD AS DATA1
END
-RUN

SQL DB2 SET SERVER DB2_SERVER
SQL DB2
Select USERNAME, LOGON_FAILURE_TMSTMP from TST.FAILED_LOGONS
WHERE USERNAME IN
(
-INCLUDE DATA1
)
FOR READ ONLY WITH UR
;
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD
END
TABLE FILE HOLD
PRINT *
ON TABLE PCHOLD AS DATA2 FORMAT HTML
END
-RUN
 
If you create a master for FAILED_LOGONS, then you can join the results back to the db2 table. Otherwise, you could probably make the data1 file comma delimited for the in statement, by using ON TABLE HOLD AS DATA1 FORMAT COM.

Code:
SQL DB2 SET SERVER DB2_SERVER
SQL DB2
Select USERNAME from TST.USERS for read only with ur
;
TABLE
ON TABLE HOLD AS DATA1
END
-RUN

TABLE FILE FAILED_LOGONS
PRINT
  USERNAME
  LOGON_FAILURE_TMSTMP
IF USERNAME EQ (DATA1)
ON TABLE PCHOLD AS DATA2 FORMAT HTML
END
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top