×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

User query results in another query

User query results in another query

User query results in another query

(OP)
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

RE: User query results in another query

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close