display value from a column in table in two separate columns

  • i have a value say 11 in one of my columns i need to compute and break it in two separate columns A and B like 6 and 5

     

    Attachments:
    You must be logged in to view attached files.
  • Like this?

    DROP TABLE IF EXISTS #t1;

    CREATE TABLE #t1
    (
    c1 INT
    );

    INSERT #t1
    (
    c1
    )
    VALUES
    (2 )
    ,(11)
    ,(4)
    ,(9);

    SELECT t.c1
    ,c2 = t.c1 / 2
    ,c3 = t.c1 - t.c1 / 2
    FROM #t1 t;

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

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

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