Results 1 to 3 of 3

Thread: denormalize

  1. #1
    Join Date
    Oct 2003
    Posts
    3

    Unanswered: denormalize

    Hi,

    Please let me know if I can populate the target table using a single query and if so how.

    Thanks in Advance,
    Yeshwant

    Source_table
    acct score type
    1 100 CB
    1 200 RIX
    2 300 BS



    Target table
    acct CB RIX BS
    1 100 200
    2 300

  2. #2
    Join Date
    Mar 2002
    Location
    Reading, UK
    Posts
    1,137
    Try

    insert into target_table
    select acct,
    max(decode(type,'CB',score,null)) CB,
    max(decode(type,'RIX',score,null)) RIX,
    max(decode(type,'BS',score,null)) BS
    from source_table
    group by acct

    Alan

  3. #3
    Join Date
    Oct 2003
    Posts
    3
    Alan that is exactly what I wanted. Thanks Much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •