Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9192347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:53:58+00:00 2026-06-17T20:53:58+00:00

I am using Oracle 11G, I have below table structure STATE_DEF table is parent

  • 0

I am using Oracle 11G, I have below table structure

STATE_DEF table is parent table

TAX_DEF_ID  EFFECTIVE_DATE  REP_TYPE
1           9-Jan-12        R
2           15-Jan-12       W

and child table ‘TAX_DETAIL’ as below

TAX_DETAIL_ID   TAX_TYPE    DISTRIBUTION_TYPE   WH_RATE   TAX_DEF_ID
1               I           S                   0.1       1
2               I           P                   0.12      1
3               D           S                   0.2       1
4               D           P                   0.22      1
5               I           S                   0.3       2
6               I           P                   0.31      2
7               D           S                   0.4       2
8               D           P                   0.41      2

I want to create a view which will given output shown below

TAX_DEF_ID  EFFECTIVE_DATE  I_S_WH_RATE    I_P_WH_RATE  D_S_WH_RATE   D_P_WH_RATE
1           9-Jan-12        0.1            0.12         0.2           0.22
2           15-Jan-12       0.3            0.31         0.4           0.41

I had tried LISTAGG function but it would give me single column with concated columns. I am looking for the view definition which will give me rates in separate columns for a effective date.

I have been trying to get this output from couple of days. I would appretiate any help to achieve above result.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:53:59+00:00Added an answer on June 17, 2026 at 8:53 pm

    Try this:

    SELECT
        SD.TAX_DEF_ID,
        SD.EFFECTIVE_DATE,
        SUM(CASE WHEN TAX_TYPE = 'I' AND DISTRIBUTION_TYPE = 'S' THEN WH_RATE ELSE 0 END) I_S_WH_RATE,
        SUM(CASE WHEN TAX_TYPE = 'I' AND DISTRIBUTION_TYPE = 'P' THEN WH_RATE ELSE 0 END) I_P_WH_RATE,
        SUM(CASE WHEN TAX_TYPE = 'D' AND DISTRIBUTION_TYPE = 'S' THEN WH_RATE ELSE 0 END) D_S_WH_RATE,
        SUM(CASE WHEN TAX_TYPE = 'D' AND DISTRIBUTION_TYPE = 'P' THEN WH_RATE ELSE 0 END) D_P_WH_RATE
    FROM STATE_DEF SD
        LEFT JOIN TAX_DETAIL TD
            ON SD.TAX_DEF_ID = TD.TAX_DEF_ID
    GROUP BY SD.TAX_DEF_ID, SD.EFFECTIVE_DATE
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an application using oracle 11g, Java(struts2) and Hibernate. I have table
I'm using Oracle 11g R2. I have a table with 9.1 billion rows. When
I am using Oracle 11g r2 . I have a table that stores images
We are using Oracle 11g and we have a table with a timestamp column
I am using oracle 11g and have a table with an XMLType. There are
I am using Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 I have a table
I'm using oracle 11g sql developer I have a varchar2 column with dates as
Using Oracle 11g release 2, the following query gives an ORA-01790: expression must have
I am using Oracle ADF in Oracle Jdeveloper 11g. In the application i have
I am using oracle 11g and have written a stored procedure which stores values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.