Copy existing row data into new table rows

  • i think it's just a select of three queries, which inserts into the new table.

    INSERT INTO NEWTABLE(ColumnList)

    SELECT RecordID,ManagerID,ManagerApprovedDate,'ManagerApproved'

    From OriginalTable WHERE ManagerID IS NOT NULL UNION ALL

    SELECT RecordID,ClerkID ,ClerkApprovedDate,'ClerkApproved'

    From OriginalTable WHERE ClerkID IS NOT NULL UNION ALL

    SELECT RecordID,FlunkyID,FlunkyApprovedDate,'FlunkyApproved'

    From OriginalTable WHERE FlunkyID IS NOT NULL UNION ALL

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Hi Lowell,

    Thank you for attempting to solve my gibberish. I worked on the UNION ALL solution you presented, but I just couldn't get it to do what I wanted; probably because I didn't do a very good job initially explaining what I need. I will edit my original post with some better data for you.

    Sherry

Viewing 2 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply