Re: dynamic column name
Date: Tue, 27 May 2008 02:27:19 -0700 (PDT)
> Dear all,
> I have problem, the query as the following:
> 1: SELECT
> 2: CASE
> 3: WHEN PRODUCT_TYPE IN (SELECT PRODUCT_TYPE FROM PROD_T WHERE
> 4: THEN (SELECT RESULT FROM PROD_T WHERE
> 5: ELSE 0
> 6: END ACCEPT_OS
> 7: FROM PRODUCTS_T OUTER
> The problem in Line #5
> The output from inner query is 'SRC' and it is single row.
> The outer table 'PRODUCTS_T' has SRC column.
> I want specify the column name from inner query (line #5).
> It is like dynamic column name.
> How can solve it?
> Best Regards;
Maybe what you really want is simply the join:
DECODE( INSIDE.PRODUCT_TYPE, 'ACCEPT_OS',INSIDE.RESULT,0) FROM PROD_T INSIDE, PRODUCTS_T OUTER
WHERE INSIDE.PRODUCT_TYPE=OUTER.PRODUCT_TYPE Regards.
Mat. Received on Tue May 27 2008 - 04:27:19 CDT