Posted: Wed Oct 27, 2004 3:32 am Post subject: Query to PLAN_TABLE & SYSIBM.SYSSTMT
Hi all,
I'd like to create a query to PLAN_TABLE join with SYSIBM.SYSSTMT (due to get the sentence).
I want to select the following fields:
Code:
SELECT A.PROGNAME,A.ACCESSTYPE,A.INDEXONLY,A.ACCESSNAME,
A.SORTC_ORDERBY,A.SORTN_ORDERBY,B.TEXT
FROM S3DED3W.PLAN_TABLE A,SYSIBM.SYSSTMT B
the input in the where clause is the program name (also is the conection between both tables). And if we have differents binds with EXPLAIN(YES) in the table for a program, get only the last one.
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Oct 27, 2004 8:40 am Post subject:
Monaco,
Try this
Code:
SELECT A.PROGNAME
,A.ACCESSTYPE
,A.INDEXONLY
,A.ACCESSNAME,
,A.SORTC_ORDERBY
,A.SORTN_ORDERBY
,B.TEXT
FROM S3DED3W.PLAN_TABLE A
,SYSIBM.SYSSTMT B
WHERE A.PROGNAME = 'your application name'
AND B.PLNAME = 'your application name'
AND A.TIMESTAMP IN (SELECT MAX(B.TIMESTAMP)
FROM S3DED3W.PLAN_TABLE A
,SYSIBM.SYSSTMT B
WHERE A.PROGNAME = 'your application name'
AND B.PLNAME = 'your application name')
;
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum