bobby2929
asked on
how to write if then else in select
hi there,
col 1 AA BB CC DD (Table 1)
Col2 BB CC DD EE (Table 2)
Col 3 Bell , CAMBRIDGE (Table 2)
Col4
If data in col1(BB) = data in col(BB) THEN WRITE BELL else null
How can write sql plz advice
thanks
Bobby
col 1 AA BB CC DD (Table 1)
Col2 BB CC DD EE (Table 2)
Col 3 Bell , CAMBRIDGE (Table 2)
Col4
If data in col1(BB) = data in col(BB) THEN WRITE BELL else null
How can write sql plz advice
thanks
Bobby
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You have an LTRIM and a RTRIM functions available in DB2 but I think the problem is not there...
There is no JOIN condition which means every STG_CUST5 is linked to every STG_ARRG thus resulting in more than the 50 first rows having non corresponding territory.
==> Can you explain what you are functionnaly looking for
hth
There is no JOIN condition which means every STG_CUST5 is linked to every STG_ARRG thus resulting in more than the 50 first rows having non corresponding territory.
==> Can you explain what you are functionnaly looking for
hth
ASKER
i thing db2 doesnt recoginze trim plz advice whts bext approach
SELECT
CASE WHEN stg_cust5.TERRITORY_CODE = STG_arrg.Rest_of_the_key THEN STG_ARRG.CUST_TERRITORY_EN
FROM STG_CUST5, STG_ARRG
fetch first 50 rows only
so i try
SELECT
CASE WHEN trim(stg_cust5.TERRITORY_C
FROM STG_CUST5, STG_ARRG
fetch first 50 rows only