Results 1 to 2 of 2

Thread: Spliting data from single col into two columns

  1. #1
    Join Date
    Feb 2009
    Posts
    1

    Spliting data from single col into two columns

    how can i create a sql to split data from a single column into 2 columns as below

    col 1

    Y
    Y
    N
    N

    into

    Col A Col B

    Y N
    Y N

    Thanks for your help.
    Anan

  2. #2
    Join Date
    Feb 2009
    Posts
    7

    Smile

    I think the simplest way to accomplish this task is using Insert & delete statement:

    Insert into Table(ColA)
    select * from Table(Col1)
    where Col1= 'Y';

    Commit;


    Insert into Table(ColB)
    select * from Table(Col1)
    where Col1<> 'Y';

    Commit;

    Then delete col1 if you wish

Posting Permissions

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