--------+---------+---------+---------+---------+---------+-----
SELECT G.AFF_ID aff-id, INTEGER(G.gdg_id) COL1
FROM XAD13.AFF_Gdg G
WHERE ( SUBSTR(G.gdg_id,1,5) IN
(SELECT CHAR(R.AFF_ID)
FROM XAD13.AFF_Gdg R)
OR SUBSTR(G.gdg_id,1,5,5,5) IN
(SELECT CHAR(R.AFF_ID)
FROM XAD13.AFF_Gdg R));
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Tue Jun 05, 2007 7:48 am Post subject:
arshadh,
Quote:
pull those gdg-id's whose first 5 bytes or last 5 bytes equals any of the aff-id column values
that is what you are receiving! what you want is those plus any aff_id that equals any gdg_id regardless of the associated gdg_id column value - which maybe a UNION of the reverse 'IN' is required. but, I am lost because I have no idea how the SQL is functioning with hyphens and underscores intermixed in your SQL.
Quote:
SELECT G.AFF_ID aff-id, INTEGER(G.gdg_id) COL1
and what is this?:
Quote:
SUBSTR(G.gdg_id,1,5,5,5)
be nice if you would include in your post the SQL that you are actually running. Or is DB2 so forgiving that you can have such syntax errors? _________________ Dick Brenholtz
American living in Varel, Germany
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