Results 1 to 3 of 3

Thread: loading data

  1. #1
    Join Date
    Jul 2005
    Posts
    276

    Unanswered: loading data

    When i'm populating data from tabB to tabA
    insert into tabA
    (
    col1,
    anal,
    col2,
    spnd,
    lab,
    ..
    ..
    )
    select
    col1
    col2
    ..
    ..
    from tabB ....
    spnd and lab are not in tabB.They are the new columns added to tabA.
    And spnd is derived from another column in tabA "anal"
    if tabA.anal in (actual) then set spnd='act'
    else if tabA.anal in (november) then set spnd='Nov'
    ..
    ..

    My question is where will this logic be inserted in the code so that the data gets loaded performing these operations.

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool


    From your statement tabA.anal is populated from tabB.col2, then you can do this:
    PHP Code:
    insert into tabA
    (
    col1,
    anal,
    col2,
    spnd,
    lab,
    ..
    ..
    )
    select 
    col1
    ,
    col2,
    col3,
    DECODE(col2,'Actual','Act','Nov'), -- spnd
    'Lab Value',   -- lab
    ..
    ..
    from tabB .... 



    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Jul 2005
    Posts
    276
    Thanks a ton LKBrwn_DBA.

Posting Permissions

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