[teiid-issues] [JBoss JIRA] (TEIID-2497) Add support for DECODE(column, column_value, column_to_replace_with)

Van Halbert (JIRA) jira-events at lists.jboss.org
Tue May 7 21:17:53 EDT 2013


    [ https://issues.jboss.org/browse/TEIID-2497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772885#comment-12772885 ] 

Van Halbert commented on TEIID-2497:
------------------------------------

The following worked:

Select IntKey, SUM(CASE StringKey WHEN '11' THEN IntNum END) As NewColumnA,
SUM(CASE StringKey WHEN '12' THEN IntNum END) As NewColumnB,
SUM(CASE StringKey WHEN '13' THEN IntNum END) As NewColumnC 
FROM BQT1.SmallA 
Group By IntKey

I assume you can close this feature request as being satisfied.  
                
> Add support for DECODE(column, column_value, column_to_replace_with)
> --------------------------------------------------------------------
>
>                 Key: TEIID-2497
>                 URL: https://issues.jboss.org/browse/TEIID-2497
>             Project: Teiid
>          Issue Type: Feature Request
>          Components: Query Engine
>    Affects Versions: 7.7.6
>            Reporter: Van Halbert
>            Assignee: Steven Hawkins
>
> Looking at pivot and trying to use it like:
> Select salesperson, SUM(DECODE(product, 'CarA', amount)) as ProductCarA,
> SUM(DECODE(product, 'CarB', amount)) as ProductCarB,
> SUM(DECODE(product, 'CarC', amount)) as ProductCarC
> From SALES
> Group By salesperson
> Teiid's Decode requires you to know the value to substitute, with this option, it can be dynamically substituted at run time. 
>         
> See:  http://www.clearpeaks.com/blog/data-warehousing/pivot-data-in-sql

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the teiid-issues mailing list